I was getting prompted to enter my password instead of authenticating with my SSH key. I thought if I deleted everything in ~/.ssh I would be able to generate a new key from my laptop, manually copy the public key, and use my SFTP client (Transmit) to add to authorized_keys on my server. Unfortunately, that did not work. I'm able to r+w in ~/.ssh, but I'm not able to edit /etc/ssh/sshd_config to enable PasswordAuthentication, through the SFTP client. I tried attaching the server (named "ubuntu") to a display that outputs:
Ubuntu 23.04 ubuntu ttyl ubuntu login:
It outputs incorrectly on everything I've tried. Is this something that can be fixed? Any suggestions would be greatly appreciated.
Link to: /var/log/auth.log https://drive.google.com/file/d/14adetEqSXUmM9-eh5ZSrvQvgP6n3ESYA
Here's the output of ➜ ssh -vvv -i id_rsa caleb@192.168.1.19 https://drive.google.com/file/d/1Ue1RS0_5JQl6_lnE65mpuscqxWfej16e
chrishall in ~/.ssh via ⬢ v19.8.1
➜ ssh -o "IdentitiesOnly=yes" -i id_ed25519 caleb@192.168.1.19
caleb@192.168.1.19: Permission denied (publickey).
chrishall in ~/.ssh via ⬢ v19.8.1
➜ ssh -o "IdentitiesOnly=yes" -i id_rsa caleb@192.168.1.19
caleb@192.168.1.19: Permission denied (publickey).
chrishall in ~/.ssh via ⬢ v19.8.1
➜ ssh -v id_ed25519 caleb@192.168.1.19
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to id_ed25519 port 22.
ssh: Could not resolve hostname id_ed25519: nodename nor servname provided, or not known
chrishall in ~/.ssh via ⬢ v19.8.1
➜ ssh -v id_rsa caleb@192.168.1.19
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include
/etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to id_rsa port 22.
ssh: Could not resolve hostname id_rsa: nodename nor servname provided, or not known
man ssh
. It will explain the required permission for~/.ssh/
, and will explain what you lost when you "deleted everything in~/.ssh
". I think you've lost allssh
,sftp
access to this system, for this userid. Can you connect a USB (or not) keyboard and mouse (along with your display). Use a powered USB Hub. Login, fix the permission on~/.ssh/
, runssh-keygen
, and fix the errors. Readman ssh-keygen
. For next time, readman ssh-copy-id
. For completeness, readman -k ssh
. – waltinator Aug 08 '23 at 23:53/etc/ssh/sshd_config
and setPasswordAuthentication yes
. That way, you can at least login with a password. Are you appending your public key to~/.ssh/authorized_keys
on server? Next, I think @steeldriver is correct about incorrect permissions. On server...~/.ssh/
should be 700 &~/.ssh/authorized_keys
should be 600. On local,~/.ssh/
should be 700 & your private key should be 600. Next, ensure~/.ssh/
&~/.ssh/authorized_keys
on server are owned by user you're logging in with. – mpboden Aug 09 '23 at 01:25Ubuntu 23.04 ubuntu ttyl ubuntu login:
and outputsLogin incorrect
for any username I enter.~/.ssh/
is 700,~/.ssh/authorized_keys
and private keys are 600, public keys are 644 on local and server owned by my username. Any idea why it's rejecting my username when I'm connected directly? – Chris Aug 09 '23 at 16:08