SSH To My Additional Non root user - Please help...

Hi all,

I am new to setting up a vps and would be grateful if someone could advise me on the following please:

I have read the setting up a vps beginners tutorial and I have understood how to log in to root via ssh keys. I have added ssh key in digital ocean portal and that all seemed to work fine.

I can log in via putty to root without any password

My problem is when adding a new user:

I can add the user fine, but adding ssh keys to the new sudo user is were iam stuck.

  1. How do I do this? Step by step would be helpful? 2.Can I use putty to log in to this new user or do i still need to log in as root and then login as new user? 3.Can I create a new private and public key in puttygen? i use the same ssh key that I use for root?

Thanks in advance


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.

Hi Colin,

Which server do you use? Ubuntu ? For now I will assume it is a Linux based server.

since you are using putty and also have putty gen installed you can create a key pair with puttygen.

Login to your new user account or switch to it from within your root login (# su newuser)

a) Create .ssh directory and apply proper permissions

mkdir ~/.ssh && chmod 700 ~/.ssh

b) Create the file to store your public get in and apply permissions

touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys

c) From your puttygen window right click on the public key string select all and copy. Make sure to safe the private key to your computer

d) Back to your console edit the authorized_keys file and paste your public key into it

vi ~/.ssh/authorized_keys

e) Either point to the private key within putty or launch pagent and load your private key in.

Note: With the pagent running you don’t need to reference the private key within your putty session. just ip and user.

f) Use putty and login using your new user name instead of root

This should do it, sir.