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..." |
Kyle.Madsen (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
# Create a new user | # Create a new user | ||
## <code>sudo su</code> | ## <code>sudo su</code> | ||
## <code>adduser "username" | ## <code>adduser "username"</code> | ||
# Add the new user to the sudo group | # Add the new user to the sudo group | ||
## <code>usermod -aG sudo "username"</code> | ## <code>usermod -aG sudo "username"</code> |
Revision as of 01:54, 12 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"
- 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.