SSH login for beginners.

I apologise for something asking something I know is well documented, but I can’t seem to get my head around this. I’ve read documentation, watched YouTube videos and followed along with Lynda all day but I’m not getting very far. I know this will take most people seconds.

I created ssh keys with puttygen. Added them to my DO and created a droplet. I can login in as root.

I want to create a new sudo and allow ssh access only. Disallow root login and have ssh login only.

I’ve tried adding new a secondary key to DO for my sudo but it won’t let me login as and the sudo user I created.

Could you please walk me through the line commands starting from logging in as root and key(s) added to my DigitalOcean account.

I know it’s just something stupid I’m doing wrong. I’ve tried generating keys via puttygen and via the terminal and I keep running into issues. When I edit the config file I see the options I should toggle/change are already in place presumably because I set my droplet up without a root password.

Should my public keys be put in the same folder or, or should each user have their public key in their own folder? Thank you!

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You have done everything right thus far.

A strategy you can use to allow a second user access is as follows…

  1. Create the droplet, login, and setup as you have already.
  2. Create a new user adduser younewusername
  3. Provide new user with sudo privileges usermod -aG sudo yournewusername
  4. You can create and new SSH Keys, or use the one you have setup already cp -rv /root/.ssh /home/yournewusername
  5. Set owner ship to your new user chown -R /home/yournewusername/.ssh
  6. Set file permissions chmod -R 0600 yournewusername:yournewusername /home/yournewusername/.ssh/*

From here logout and log back in using yournewusername and test the sudo abilities (ie sudo apt update)

If this works, then you can proceed to lock the root account.

Sun Day