Skip to content

Instantly share code, notes, and snippets.

@blift
Created January 15, 2021 12:27
Show Gist options
  • Save blift/0607090190ba65c5c9bc6e79f99a4dda to your computer and use it in GitHub Desktop.
Save blift/0607090190ba65c5c9bc6e79f99a4dda to your computer and use it in GitHub Desktop.
Digital Ocean public key denied
In DO problem with paste new key via web console, below description how to do it via terminal on mac
1. Recovery password in DO to root
2. After login to root via console, check the list of users
(for ubuntu)
# cut -d: -f1 /etc/passwd
3. Switch to another user if is created if not create new user or proceed with root
https://askubuntu.com/questions/410244/is-there-a-command-to-list-all-users-also-to-add-delete-modify-users-in-the
4. change permission to server
# sudo nano /etc/ssh/sshd_config
PermitRootLogin prohibit-password to PermitRootLogin yes
PasswordAuthentication no to PasswordAuthentication yes
5. If the ssh key is still conflict and you can't access via terminal remove ssh for root
# nano ~/.ssh/authorized_keys
delete full key
6. Restart ssh service
# sudo systemctl restart ssh
7. Now in terminal add your key
# ssh-add -K
8. Try to login via terminal ssh user@123.123.123.12
9. add new ssh to authorized_keys
# nano ~/.ssh/authorized_keys
Paste new public key and save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment