By KivxD
I’ve followed the tutorial on setting up my droplet and installed a SSH key while creating my droplet. Since I’m using Windows, I have been using PuTTY to connect to my server; but I always log in as the root user and not the non-root sudo user I created. How do I create a profile on PuTTY that uses my sudo user instead?
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!
when saving session in PuTTY, click data from the left panel and put the non-root username in auto-login username field and save.
Which tutorial did you follow?
I’ll use username as the username in this example.
1). Create the users home directory and the .ssh directory where we’ll store the users’ key.
mkdir -p /home/username/.ssh
2). Add the user and set their home directory to the one we just created.
useradd -d /home/username username
3). Add the user to the sudo group.
usermod -aG sudo username
4). Create our authorized_keys file.
touch /home/username/.ssh/authorized_keys
5). Setup proper permissions on the .ssh directory, authorized_keys file, and home directory.
chmod 700 /home/username/.ssh
chmod 644 /home/username/.ssh/authorized_keys
chown -R username:username /home/username
6). Now you need to paste in your public key to the authorized_keys file located here:
/home/username/.ssh/authorized_keys
At this point, you should be able to login via SSH if everything is configured correctly.
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.