Operating System - HP-UX
1832247 Members
2336 Online
110041 Solutions
New Discussion

Re: how to su a user id without password

 
SOLVED
Go to solution
hangyu
Regular Advisor

how to su a user id without password

In the system ,there is a user id "user1" , I want to let other user id can su to this id without input password , but this user id (user1) MUST have password ( can't be null password), can advise what can i do ? thx.
6 REPLIES 6
Peter Godron
Honored Contributor
Solution

Re: how to su a user id without password

Yang Qin_1
Honored Contributor

Re: how to su a user id without password

It depends on how you want to secure your system.

1. Use sudo. When user2 su to user1, system will ask for password of user2 but not user1.

2. Easy but "dirty". Create .rhosts file in user1's home dir. In .rhosts file put

hostname user2
hostname user3
hostname user4

When user2, 3, 4 ... do a rlogin hostname -l user1. The system will log user2 in with password challenge

Yang
Victor BERRIDGE
Honored Contributor

Re: how to su a user id without password

Hi,
Just for information, in sudo, there is an option NOPASSWD...
How would batches work otherwise...
So it is your best choice


All the best
Victor
Doug O'Leary
Honored Contributor

Re: how to su a user id without password

Hey;

Sudo is probably the quickest/easiest solution. Another possiblity is to use ssh w/Public Key authentication.

Each user generates their ssh key paris, adds the public key to the ~${user1}/.ssh/authorized_keys file.

From there the authorized users would be able to "ssh -l ${user1} [localhost|$host]" to get a shell or ssh -l ${user1} [localhost|$host] ${command} to execute commands.

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Pratyush Paul_1
Valued Contributor

Re: how to su a user id without password

hi - there are 2 options for you.

1. you can use ssh and use the authorized keys to allow the user.

2. you can use sudo with NOPASSWD option for that user.

Please do not use .rhost file, there is security risk. Given a choice I would be using sudo.

Thanks

Pratyush
Die Hard
Doug O'Leary
Honored Contributor

Re: how to su a user id without password

>>2. you can use sudo with NOPASSWD option for that user.

>>Please do not use .rhost file, there is security risk. Given a choice I would be using sudo.

I've always considered the NOPASSWD option to sudo to be as big, if not bigger security hole as the ~/.rhosts files.

If you need batch processing which requires running commands as another user, your best option is ssh with public key authentication. Sudo is easier to connfigure, but is significantly less secure if you're using the NOPASSWD option.

Assuming you don't need batch processing, sudo is probably your best/easiest solution.

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html