I have a my droplet with SSH key and it works properly. I created a new user in this droplet. I want to create a new SSH key for this new user. I will use this user for my php website. So, this new ssh key must be different from the root user key. How can I do that?
I’ve been doing a lot of research. But I could not find something that works.
You should be clear on the answers you provide. Because my english is not good. Thanks.
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.
Almost the same steps as before:
puttygensave the private key to your hard disk.
su userthen create a directory called
.sshin your home directory and create a file inside it called
.authorized_keysand paste the public key there.
puttyenter your droplet IP then browse to
SSH -> auththen choose
Browse...and open your private key which you saved before.
Connection -> dataand enter your user name in
Sessionchoose a name for your session and choose
savenow you can connect.
Hope this helps.
You need to create a new ssh key pair using
ssh-keygenBUT BE CAREFUL to change the name of the private key to something different that
~/.ssh/id_rsa, you can call it
Upload your new public key to the server with this command
ssh-copy-id -i ~/.ssh/id_user_rsa user@droplet_ip, you will be prompted for your new user’s password here.
Then when you want to connect to your droplet using your new user use this command
ssh -i ~/.ssh/id_user_rsa user@droplet_ip
Hint: if you need to create a shortcut you can use this file
~/.ssh/configadd this content to it
Now connect using this command
Hope this helps, revert back to me if you needed more help.
Want to learn more? Join the DigitalOcean Community!
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.
Sign up now