I am trying to connect to my Ubuntu server using ssh and a public key. I have disabled the connection from remote using a password, so I can only login using a key.
There are two users on my server. When I connect using the pubkey for the first user, everything goes fine. Connection is made, key is checked, I get logged in with no issues.
But when I try to log in as the secondary user, then the connection is refused. These were my steps. Suppose my secondary username is
- I created a new pair of keys on my system using
ssh-keygen -o -a 100 -t ed25519 -f id_tom -C "tom"
- copied the public key into the clipboard
- once on the server as
tom, I made a new
homeand created new
authorized_keysfile, changing the permissions file to
600and pasted the public key
I appended the following lines to
~/.ssh/configon my local machine:
Host tom_server HostName 6220.127.116.11 User tom IdentityFile ~/.ssh/path/to/id_tom IdentitiesOnly yes
Looking at the debug log, I can say that ssh correctly tries to authenticate as
tom and the right key is passed to the server. So what could be the issue here? What am I overlooking?
Update: I have tried the solutions posted in Why am I still getting a password prompt with ssh with public key authentication? and nothing so far has worked.