System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Password usage in sudoers file

 
ofure
Occasional Advisor

Password usage in sudoers file

Hi,
I will like to be able to switch to another user in sudo and prompted for the password of that target user.
I have tried putting this into my sudoers file:
Defaults targetpw

But still does not work.
Any help.

# su - ctmag
$ su - oracle-rpp
Password:
Sorry, try again.
Password:
sudo: 1 incorrect password attempt
5 REPLIES
sangilak
Trusted Contributor

Re: Password usage in sudoers file

Hi,


'sudoers' only related to 'sudo' and not 'su'.

On HP-UX sudo is not installed by default (although you can install a port if IIRC).

So changes made in the 'sudoers' file will not affect the behaviour of 'su'.

Somebody please correct me if I am wrong!


sangilak
ofure
Occasional Advisor

Re: Password usage in sudoers file

Hi,

I have scripted the su command to call up sudo command in /bin/su.
So instead of typing sudo ...., I will just type su - and it works fine.

Regards,
nijokj
Trusted Contributor

Re: Password usage in sudoers file

after login to ctmag user run sudo -l command to check what are the commands enabled for this user with or without issueing the password.
ofure
Occasional Advisor

Re: Password usage in sudoers file

Is it possible for a user to be prompted for the password of the target user when you want to switch to the user in sudo.
Patrick Wallek
Honored Contributor

Re: Password usage in sudoers file

Yes, I think it is possible.

If you do that though, why use sudo? If the user knows the password or the target user they could just log in as that user. From my perspective that's defeating the purpose of sudo.