Operating System - HP-UX
1827459 Members
3973 Online
109965 Solutions
New Discussion

sudo user without input password

 
SOLVED
Go to solution
ust3
Regular Advisor

sudo user without input password

I want to let userA can su to userB , but it as to input userB password , can advise how to set to no need to input password ? thx
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: sudo user without input password

Shalom,

su is not a part of the sudo package. Two things. I've never checked, but sudo may use su commands, but you are making an association that is not there.

To let userA use commands normally available to userB without a password, you can use sudo.

You need to set up a command group and assign privileges to userA. sudo is normally used to provide non-privileged users with certain commands, not full access.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Court Campbell
Honored Contributor
Solution

Re: sudo user without input password

you need to add a line like this to the sudoers file:

userA ALL = NOPASSWD: /usr/bin/su - userB

then the user can do this

# sudo su - userB

and should not have to type a password.

"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Yogeeraj_1
Honored Contributor

Re: sudo user without input password

hi,

ssh would be another option.


ssh userB@localhost

(assuming it has been properly configured and authorized_keys properly updated)



hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
ust3
Regular Advisor

Re: sudo user without input password

I got it , thx all much.
Aussan
Respected Contributor

Re: sudo user without input password

hi ust3

if you want userA to su to userB only and no one else then do this

SU = /usr/bin/su - userB, !/usr/bin/su -, !/usr/bin/su "", !/usr/bin/su
*root*, !/usr/bin/su - root

userA ALL = NOPASSWD: SU


in the definition of SU we are telling it he can su as userB but not as root

Regards

Aussan
The tongue weighs practically nothing, but so few people can hold it