Last active
February 10, 2020 12:56
-
-
Save jrjhealey/da10b4b3fa57aed3acdf5585a18ba806 to your computer and use it in GitHub Desktop.
Adding Server Users (reminder for myself)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1 | |
# Add the user with | |
sudo adduser username | |
# Ensure a temporary password is given to the account else it remains locked | |
# other options can be left blank | |
# Add the username to the AllowedUsers field in /etc/ssh/sshd_config (on the server) | |
# Next step is often easier to do as the new user to avoid messing up file ownership | |
sudo -i -u newuser | |
# Copy the users RSA public key in to the authorized_users file in their home directory. | |
mkdir /home/newuser/.ssh | |
chmod -R newuser:newuser 700 /home/newuser/.ssh # if files are created as the new user, the group ownerships (user:user) can be omitted | |
touch /home/newsuer/.ssh/authorized_keys | |
chmod -R newuser:newuser 600 /home/newuser/.ssh/authorized_keys | |
# Copy and paste the public key in to the empty authorised keys. | |
# Restard the SSH daemon to confirm the changes: | |
sudo service ssh restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment