Score:0

Cannot SSH to Linux VPS using second account with SSH key

us flag

My main work machines are Macs these days, but I still have a Linux VPS running for tinkering purposes. For convenience, I use Termius

enter image description here

There are 2 accounts on my Linux VPS: root and anta40. To login, I use SSH keys instead of password. Login as root works fine. There is trouble login as anta40, though. Here's the log, which says " Authentication that can continue: publickey" :

 Starting a new connection to: "XXX.XXXX.XXX.XXX" port "22"
⚙️ Starting address resolution of "XXX.XXXX.XXX.XXX"
⚙️ Address resolution finished
⚙️ Connecting to "XXX.XXXX.XXX.XXX" port "22"
 Connection to "XXX.XXXX.XXX.XXX" established
⚙️ Starting SSH session
⚙️ Remote server: SSH-2.0-OpenSSH_9.0p1 Debian-1+b1
⚙️ Agreed KEX algorithm: ecdh-sha2-nistp256
⚙️ Agreed Host Key algorithm: ecdsa-sha2-nistp256
⚙️ Agreed server-to-client cipher: aes128-ctr MAC: hmac-sha2-256
⚙️ Agreed client-to-server cipher: aes128-ctr MAC: hmac-sha2-256
⚙️ Agreed client-to-server compression: none
⚙️ Agreed server-to-client compression: none
⚙️ Handshake finished
 Checking host key: XX:XXX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
 Host "XXX.XXXX.XXX.XXX":"22" is known and matches
 Authenticating to "XXX.XXXX.XXX.XXX":"22" as "anta40"
⚙️ Available client authentication methods: publickey,password,keyboard-interactive
⚙️ Authentication that can continue: publickey
 Authenticating using publickey method
❗ Authentication failed (publickey)
⚙️ Partial success: no
⚙️ Authentication that can continue: publickey
 No more authentication methods to try

Here's what I already did so far (as root):

  • Create a /home/anta40/.ssh/authorized_keys which contains anta40's public key
  • chmod 700 /home/anta40/.ssh
  • chmod 600 /home/anta40/.ssh/authorized_keys
  • chown -R anta40:anta40 /home/anta40/.ssh

What's wrong here?

Nikita Kipriyanov avatar
za flag
Please clarify, `/home/anta40/ssh/.authorized_keys` or `/home/anta40/.ssh/authorized_keys`?
anta40 avatar
us flag
Arrghh sorry for the typo. The latter is the correct one. Already updated my post to clarify the issue.
Nikita Kipriyanov avatar
za flag
Wouldn't you check logs at the server side in the event of the failed attempt? I mean, maybe server knows better why it rejects.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.