Skip to content

Instantly share code, notes, and snippets.

@rgreenjr rgreenjr/SSH Host Setup.md

Last active Dec 30, 2019
Embed
What would you like to do?
# open the ssh configuration file
sudo vi /etc/ssh/sshd_config

Make the following changes to /etc/ssh/sshd_config:

# disable password authentication
PasswordAuthentication no
 
# disable root login
PermitRootLogin no
 
# limit login to users to 'ssh' group
AllowGroups ssh
 
# disable hostname lookup
UseDNS no

Save and exit, then reload ssh service:

sudo reload ssh

Adding new user:

adduser --shell /bin/bash --ingroup ssh username

Adding existing user to ssh group:

usermod -a -G ssh username

Ensure permissions are correct:

sudo chown -R username:username /home/username/.ssh
sudo chmod 0700 /home/username/.ssh
sudo chmod 0600 /home/username/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.