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.
Thanks in advance
Colin
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!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
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.