Operating System - HP-UX
1825805 Members
2902 Online
109687 Solutions
New Discussion

Re: Switching to other users without supplying password

 
Yeo Khian Wei
Occasional Advisor

Switching to other users without supplying password

Hi
I have a question here. If I were to switch to other users without supplying password, can I still use the su command? If I'm not able to perform that using su, what are the ways that I can use to fulfill my need? Thanks

Cheers,

Khian Wei
9 REPLIES 9
Nicolas Dumeige
Esteemed Contributor

Re: Switching to other users without supplying password

Hello,

root doesn't need to provide password in order to log or issue a command as another user.

If you need to do various task, use this kind of syntax :
su - user -c "command"
su - user2 -c "other_command"

Cheers

Nicolas
All different, all Unix
Yeo Khian Wei
Occasional Advisor

Re: Switching to other users without supplying password

Oh...maybe I should make myself clearer. I want to switch from a non-root user to another non-root user without supplying password. So does su command still take care of that?

Regards
Khian Wei
Nicolas Dumeige
Esteemed Contributor

Re: Switching to other users without supplying password

No su won't accept it.

1) If all users have something in commun, have you consider using group privilege ? That's the most natural way to do it.

2) If you still want to log without password, use rsh with .rhost or ssh with a null passphrase against localhost.

All different, all Unix
Johan Lorimier
Frequent Advisor

Re: Switching to other users without supplying password

Hi,

use the .rhosts facility, and su will no not ask any password

.rhosts file of the user you want to be :

servernanme username_who_login


Johan
Yeo Khian Wei
Occasional Advisor

Re: Switching to other users without supplying password

Both users are not of the same group nor can I make them the same group.
Using rhosts facility, I thought that is only implemented if you are accessing different nodes? U mean u can use it within the same node?

Regards
Khian Wei
Nicolas Dumeige
Esteemed Contributor

Re: Switching to other users without supplying password

Yes
All different, all Unix
Victor BERRIDGE
Honored Contributor

Re: Switching to other users without supplying password

Hi,
About your last reply, I dont know about su but it works for rlogin:
rlogin -l , hostname being the box itself...

About you su problem I would recommend you to use su:
You can get sudo from:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.7p5/

or the main sudo site if you wish to get the latest version or compile yourself:

http://www.courtesan.com/sudo/

It does exactly what you wish (that is if you give the good option NOPASSWD... read the man pages and look at the samples)

Good luck
All the best

Victor
Yeo Khian Wei
Occasional Advisor

Re: Switching to other users without supplying password

Hi
I have another restriction, that is due to security reasons, I will not be able to use the .rhosts file. So does that mean that sudo is the only way out here?

Thanks

Khian Wei
hein coulier
Frequent Advisor

Re: Switching to other users without supplying password

in sudo you can configure

youruser ALL = (targetuser) /usr/bin/ksh

you can become the other user with the command

sudo -u targetuser /usr/bin/ksh