HOW TO ADD AN EXISTING PRIVATE SSH KEY TO USERS ON LINUX
When trying to use a private key as a new user, you must first create a .ssh directory for that new user, followed by creating an authorized_keys file inside of that .ssh directory for the user. Then, copy the key stored inside the authorized_keys file inside the .ssh directory under the /root directory.
Inside of the new user’s /home directory, create a directory called ‘.ssh’ by typing:
Mkdir .ssh
(The .ssh folder will be a hidden folder, and can only be seen by running ‘ls -a’)
Inside the .ssh directory run by typing:
touch authorized_keys
From your /root directory, run the following command:
cat /.ssh/authorized_keys >> /home/username/.ssh/authorized_keys
This will append what you have in /root’s authorized_keys file to the specified user’s authorized_keys file, allowing your new user access via private SSH.
READ: How to Create New Users and Grant Sudo Privileges to Users on Linux
Join our Private Discord Chat to chat with, as well as find community assistance from other Verified SkySilk Users: https://invite.gg/SkySilk
CLICK TO DEPLOY AN UBUNTU LINUX VPS
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article