I have ubuntu 16.04 I have disabled root login. I have a user with sudo.
I made an ssh authentication key pair: I tried to scp my public key but was told that the file doesnt exist. I copied the public key to text edit on my mac. I pasted it into a file I created in .ssh called authorized_keys. A file called authorized also appeared. I changed the permissions in sshd_config to allow authorized keys and not allow password login. I chmod 400 authorized keys and authorized. I chmod 700 .ssh
The long and the short of it is that I cant get into my server, no password, no root, no keys, I dont even get aske for my phrase.
I hope I’m not completely stuffed cos I really dont want to destroy my droplet and start again.
Any ideas? In case its not painfully obvious I am a complete noob and just working from a book so super easy answers would be appreciated.
Thanks all
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey @sfrasera70137b785a5be62b45 !
I hope you didn’t disable root login first, then created a user and gave it sudo perms :S Always try to test new implementations before removing old ones.
Anyway, it looks like you misunderstood the way SSH keys work. In short:
You should not chmod the authorized_keys with 400. Try to use the following:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
If you like to follow it, I have a tutorial made for this: Setting up SSH keys on Debian. It’s a tutorial for Debian but works on ubuntu as well. The only thing that changes is restarting the ssh service:
service ssh restart
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.