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
    Commented Dec 13, 2015 at 17:18
  • 2
    Try creating a sudo rule which permits the usera to "sudo su - userb".
    – steve
    Commented Dec 13, 2015 at 17:19
  • Thanks @steve , any other solution except sudo ?
    – Prasad
    Commented Dec 13, 2015 at 17:21
  • 1
    Include ssh key of B in .ssh/authorized_keys of A.
    – ctrl-d
    Commented Dec 13, 2015 at 17:22

2 Answers 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.


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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .