Can the same ssh key be used to access two different users on the same server?
- by Nick
I have an new ubuntu (hardy 8.04) server, it has two users, User1 and User2. User1 is listed in sudoers. I appended my public ssh key to authorized_keys in /home/user1/.ssh/authorized_keys, changed the permissions on user1/.ssh/ to 700 and user1/.ssh/authorized_keys to 600 and both file and folder are owned my User1. Then added I User1 to sshd_config (AllowUsers User1). This works and I can login into User1
debug1: Offering public key: /Users/nick/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
Last login: Mon Mar 15 09:51:01 2010 from 86.141.61.197
I then copied the authorized_keys file to /home/user2/.shh/ and changed the permissions and ownership and added User2 to AllowUsers in sshd_config (AllowUsers User1 User2). Now when I try to login to User2 it will not authenticate the same public key.
debug1: Offering public key: /Users/nick/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/nick/.ssh/identity
debug1: Trying private key: /Users/nick/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Am I missing something fundamental about the way ssh works?
Thanks in advance,
Nick