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!
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!
You have done everything right thus far.
A strategy you can use to allow a second user access is as follows…
adduser younewusernamesudo privileges usermod -aG sudo yournewusernamecp -rv /root/.ssh /home/yournewusernamechown -R /home/yournewusername/.sshchmod -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.
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.