How do I log in with a new user to Ubuntu 14.04 with SSH keys through Putty after setting up keys for root?

So I followed one of the tutorials on here and generated SSH keys through Putty for the root user on my Ubuntu VPS. I can log into the VPS fine with the root user using the SSH keys. Now i want to add another user but how do I log in using an SSH key? Do i have to create another private key for the new user?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

If you would like to have the new use login with his own SSH key, you should create a new key and add it to the user. To do that, first of all create a new user with your root user:

adduser mynewusername

After this, you need to create a new Public/Private key. You can do this for example using PuttyGen on your own client or in your linux server. Once you got the keys, upload the public key to your droplet. Now we will put it in the right place. You should be adding this key to the user’s authorized_keys file, but we don’t have that file yet, so we’ll just move it and set permissions. With your new user in the home directory:

$ mkdir .ssh
$ mv .ssh/authorized_keys
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys

After this is done, you should be able to login to your droplet with your new user using the SSH private key.