Can the public ssh key from my local machine be used to access two different users on a remote serve

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-03-15T11:24:55Z Indexed on 2010/03/15 12:09 UTC
Read the original article Hit count: 577

Filed under:
|
|
|

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 (my local machine's public key local/Users/nick/.ssh/id_rsa.pub) to authorized_keys in remote_server/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 ..*.*

I then copied the authorized_keys file remote_server/home/user1/.ssh/authorized_keys to remote_server/home/user2/.shh/authorized_keys 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

© Stack Overflow or respective owner

Related posts about openssh

Related posts about ssh