How do I use PuTTY to log in to a non-root user on Ubuntu 16.04?

Posted March 3, 2017 6.9k views
Getting StartedUbuntu 16.04

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?

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.

Submit an Answer
2 answers

when saving session in PuTTY, click data from the left panel and put the non-root username in auto-login username field and save.

  • Are there any other changes other than changing the auto-login username? I tried it and it doesn’t work. I installed the public key already in my non-root user but I’m getting authentication problems.


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:


At this point, you should be able to login via SSH if everything is configured correctly.