Operating System - HP-UX
1837277 Members
2951 Online
110115 Solutions
New Discussion

su to another user without password

 
SOLVED
Go to solution
hangyu
Regular Advisor

su to another user without password

there are two user in the system , eg. userA and userB , they are general user , if I want to userA can su to userB but without input the password of userB , can advise what can I do ? except ssh method , can advise another method ? thx

ps. please ignore the security issue.
9 REPLIES 9
Patrick Wallek
Honored Contributor
Solution

Re: su to another user without password

You would have to use a tool like 'sudo' and set userA up to do something like 'sudo su - userB'. You can set sudo up to NOT require entry of userA's passwd as well.

A. Clay Stephenson
Acclaimed Contributor

Re: su to another user without password

The only time that su does not prompt for the password is when the effective euse id is zero (ie root). If it worked any other way imagine the huge security hole that would introduce. You really have two choices: 1) sudo 2) Create a setuid wrapper program. Sudo is the far more secure option.
If it ain't broke, I can fix that.
Yogeeraj_1
Honored Contributor

Re: su to another user without password

hi,

note that you can download sudo as part of Internet express and compiled many options enabled.

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=
HPUXIEXP1111

for more info, see:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?admit=716493758+1090940400855+28353475&threadId=630557


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
hangyu
Regular Advisor

Re: su to another user without password

thx ,

I use rlogin , the userA can su to userB without password now, but I have another requirement , I want to write a script , the script run by userA and su to userB then rcp a file to remote server , like below , but have error , it seems the rlogin has problem , I have test that userA can su to userB and scp file to remote server ( test it manually ) , but why can run it with a script , can advise what is wrong in my script ? thx

script :

SU="rlogin -l userB localhost"
${SU} "scp test.file remotehost:/tmp

error :
usage: rlogin [ -8EL] [-e char] [ -l username ] host
phase 2
usage: rlogin [ -8EL] [-e char] [ -l username ] host
Peter Nikitka
Honored Contributor

Re: su to another user without password

Hi,

the command 'rlogin' does interactive login - no addtional commands can be supplied. Use 'remsh' instead; as well you need balanced quotes - I suggest you try something like this:

SU="remsh -n -l userB localhost"
${SU} "scp -q test.file remotehost:/tmp"

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Tor-Arne Nostdal
Trusted Contributor

Re: su to another user without password

Can't see why you dont want to use ssh... as it is far the simplest way...

In principle it seems as you want to have two equivalent users, so why can't you define them with same uid ?
The two users can have individual environment settings, home directory aso. but still have identical rights to each others files.

/Tor-Arne
I'm trying to become President of the state I'm in...
Peter Nikitka
Honored Contributor

Re: su to another user without password

Hi hangyu,

can you give a feedback to our solutions?

And:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Berd
Trusted Contributor

Re: su to another user without password

I also would use ssh. Once setup this would provide the functionality you are looking for and be more secure than remsh. Your command formats would remain similar.

ssh username@host command

Regards,
Berd
Trupti
Occasional Advisor

Re: su to another user without password

Hi,
you can use any of three methods.
I)sudo- you have to install this
II)RLOGIN-Make configuration changes in $HOME./rhosts file( for user equivalency) or /etc/host.eqv file( for hosts equivalency)
III)user ssh-This also you have to installed in server,But very secure method.
You can configure ssh to switch without passwd.You have to generate public/private key & a procedure for this single sign on.


Choice is yours.


Trupti