Add an SSH user to Digital Ocean: Difference between revisions
Jump to navigation
Jump to search
Kyle.Madsen (talk | contribs) No edit summary |
Kyle.Madsen (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 21: | Line 21: | ||
## create a new file with "username" as the title and the content of the authorized_keys file created above. | ## 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. | # 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. | ||
=== Troubleshooting == | |||
SSH errors | |||
:Change /etc/ssh/sshd_config | |||
::permitRootLogin yes | |||
:::back to no | |||
::AllowUsers test username |
Latest revision as of 20:04, 8 October 2024
Add an SSH enabled user to Digital Ocean
[edit | edit source]Steps to build the local account and allow SSH connection
[edit | edit source]- 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.
= Troubleshooting
[edit | edit source]SSH errors
- Change /etc/ssh/sshd_config
- permitRootLogin yes
- back to no
- AllowUsers test username
- permitRootLogin yes