I have an Ubuntu server with two users: user1 and user2. I have generated a SSH key locally and copied the public part to both users' authorized_keys file. I am able to login as both users:
srimanth@local:~$ ssh user1@server
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-31-generic x86_64)
...
Last login: Fri Mar 20 04:11:08 2015 from A.B.C.D
user1@server:~$
srimanth@local:~$ ssh user2@server
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-31-generic x86_64)
...
Last login: Thu Mar 19 22:45:26 2015 from A.B.C.D
user2@server:~$
But, if I don't mention the username authentication fails:
srimanth@local:~$ ssh -v server
...
debug1: Connection established.
debug1: identity file /home/srimanth/.ssh/id_rsa type -1
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: srimanth@local
debug1: Trying private key: /home/srimanth/.ssh/id_rsa
...
debug1: No more authentication methods to try.
Permission denied (publickey).
Please help me how do I solve this issue.