Hi everyone.
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!
Accepted Answer
Almost the same steps as before:
puttygen
save the private key to your hard disk.su user
then create a directory called .ssh
in your home directory and create a file inside it called .authorized_keys
and paste the public key there.putty
enter your droplet IP then browse to SSH -> auth
then choose Browse...
and open your private key which you saved before.Connection -> data
and enter your user name in Auto-login username
Session
choose a name for your session and choose save
now you can connect.Hope this helps.
You need to create a new ssh key pair using ssh-keygen
BUT BE CAREFUL to change the name of the private key to something different that ~/.ssh/id_rsa
, you can call it ~/.ssh/id_user_rsa
.
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/config
add this content to it
Host user_droplet
Hostname droplet_ip
User user
IdentityFile ~/.ssh/id_user_rsa
Now connect using this command ssh user_droplet
Hope this helps, revert back to me if you needed more help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.