1

I have one server X, and having 2 user accounts A and B. How to give user access B to user account A.

  • [B@Server X ~]$ su - A Password: ,I need to give access user account A to access B account without password. i am using ssh key authentication. – Prasad Dec 13 '15 at 17:18
  • 2
    Try creating a sudo rule which permits the usera to "sudo su - userb". – steve Dec 13 '15 at 17:19
  • Thanks @steve , any other solution except sudo ? – Prasad Dec 13 '15 at 17:21
  • 1
    Include ssh key of B in .ssh/authorized_keys of A. – ctrl-d Dec 13 '15 at 17:22
2

As ctrl-d said, my first thought would be have them (userB) create a ssh key, and add it to your (userA) .ssh/authorized_keys file. This would allow userB to "ssh usera@host" without knowing the password, without the password being stored insecurely, and would not be affected by userA changing passwords.

You can also restrict them to running a single command, if they only need access for a specific purpose using command="command-to-allow" in the authorized_keys file.

1

I will probably get flak for this since it seems to be somewhat controversial, but if you want the two users to be identical as far as the system is concerned, you can edit /etc/passwd to give them both the same UID. The UID is what the kernel uses to determine file access rights and other privileges: it doesn't care about your username.

This can have same strange side effects, though, so use it only if you know what you're doing.

I encourage you to read the answers and comments at Why can I create Users with the same UID?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.