Add an SSH user to Digital Ocean: Difference between revisions
Jump to navigation
Jump to search
Kyle.Madsen (talk | contribs) Created page with "== Add an SSH enabled user to Digital Ocean == === Steps to build the local account and allow SSH connection === # Generate an SSH key pair. # Log into the server via already..." |
(No difference)
|
Revision as of 17:50, 6 June 2023
Add an SSH enabled user to Digital Ocean
Steps to build the local account and allow SSH connection
- Generate an SSH key pair.
- Log into the server via already established SSH user.
- Create a new user
sudo su
adduser "username" --disabled-password
- Add the new user to the sudo group
usermod -aG sudo "username"
- change to new user to create and give folders correct permissions
sudo su - new_user
mkdir /home/"username"/.ssh
chmod 700 /home/"username"/.ssh
touch /home/"username"/.ssh/authorized_keys
chmod 600 /home/"username"/.ssh/authorized_keys
- Copy the text of the .rsa file to the new authorized_keys file.
- The above is best practice but does not seem to work on our servers. Below are the extra steps to allow a user to authenticate via ssh.
- Become root sudo user again
sudo su
- Navigate to
/etc/ssh/authorized_keys
- create a new file with "username" as the title and the content of the authorized_keys file created above.
- This should allow the user to login via SSH as long as they have the matching private key in their local SSH folder and know the associated password.