Different Users - different SSH keys

0

1

I have two users on my Ubuntu server:

  • user1 (home: /home/user1 - owned by user1) has sudo rights
  • user2 (home: /opt/apps - not owned by user2) is only used for sftpd.

I disabled password login to only login via a key-pair. I generated two different key-pairs, one for each user. I stored the public keys in /etc/ssh/authorized_keys/user1 and /etc/ssh/authorized_keys/user2. The files user1 and user2 are owned by the user. chmod for the directory authorized_keys is 700 and 600 for the key files.

My sshd_config looks like following:

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /etc/ssh/authorized_keys/%u

Connection with user1 works just fine, but I cannot connect with user2 at all. Using FileZilla I get the following error:

Error: Disconnected: No supported authentication methods available (server sent: publickey)

although FileZilla is sending the correct private key to the server.
Using FileZilla with user1 works just fine.

I checked the log. First I had the following message:

Sep  1 20:06:55 cloud4298846 sshd[12727]: User Minecraft from *MY_IP* not allowed because not listed in AllowUsers
Sep  1 20:06:55 cloud4298846 sshd[12727]: input_userauth_request: invalid user Minecraft [preauth]
Sep  1 20:06:55 cloud4298846 sshd[12727]: error: Received disconnect from *MY_IP* port 50117:14: No supported authentication methods available [preauth]
Sep  1 20:06:55 cloud4298846 sshd[12727]: Disconnected from *MY_IP* port 50117 [preauth]

So I wrote Minecraft as allowed user in the /etc/ssh/sshd.config

No I am receiving this message:

Sep  2 19:01:54 cloud4298846 sshd[15115]: error: Received disconnect from *MY_IP* port 53711:14: No supported authentication methods available [preauth]
Sep  2 19:01:54 cloud4298846 sshd[15115]: Disconnected from *MY_IP* port 53711 [preauth]

Thats basically the same message I get in FileZilla but I don't understand why.

Marcel

Posted 2019-09-01T18:01:54.883

Reputation: 9

Did you check server log file? – Martin Prikryl – 2019-09-02T07:34:04.510

yes, see updated question – Marcel – 2019-09-02T17:09:54.337

Can you post more complete and verbose log file? – Martin Prikryl – 2019-09-02T18:55:55.277

No answers