Hi everyone, currently trying to SSH into a Digital Ocean droplet and I’m getting this error "Permission denied (publickey). I’ve added the key to the SSH Keys section on DO, and I’ve ran “ssh-add” for the key but no dice so far.
Here are the steps I took to get here.
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): digiocean
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in digiocean
Your public key has been saved in digiocean.pub
The key fingerprint is:
SHA256:**** username@username
Afterwards I cat the public key and place it on DO’s ssh key section.
It proceeds to give me this error.
ssh root@ipaddress
root@ipaddress: Permission denied (publickey).
So I go back and check everything.
eval $(ssh-agent)
It is indeed running.
ssh-add ~/.ssh/digiocean
outputs
Identity added: /home/username/.ssh/digiocean (username@username)
I try again, same issue.
ssh root@ipaddress`
root@ipaddress: Permission denied (publickey).
I have also tried the following.
ssh -i ~/.ssh/digiocean root@ipaddress`
root@ipaddress: Permission denied (publickey).
[UPDATE] I am now getting this error.
ssh -i ~/.shh/digiocean root@ipaddress
Warning: Identity file /home/username/.shh/digiocean not accessible: No such file or directory.
root@1ipaddress: Permission denied (publickey).
Here is the output of file permissions
ls -la /home/username/.ssh/
total 36
drwx------ 2 username username 4096 Apr 13 06:57 .
drwx------ 59 username username 4096 Apr 13 07:18 …
-rw------- 1 username username 2610 Apr 13 06:52 digiocean
-rw-r–r-- 1 username username 577 Apr 13 06:52 digiocean.pub
-rw------- 1 username username 419 Feb 25 19:11 id_ed25519
-rw-r–r-- 1 username username 107 Feb 25 19:11 id_ed25519.pub
-rw------- 1 username username 4157 Apr 7 01:14 known_hosts
-rw-r–r-- 1 username username 2665 Apr 5 00:15 known_hosts.old
Any help would be greatly appreciated!