Skip to content

Instantly share code, notes, and snippets.

@whonion
Last active July 22, 2023 17:21
Show Gist options
  • Save whonion/d013f5ad2d53084a69fa73d4d17b51d0 to your computer and use it in GitHub Desktop.
Save whonion/d013f5ad2d53084a69fa73d4d17b51d0 to your computer and use it in GitHub Desktop.
ssh-keygen -t rsa
#set passphrase on your private_key
cp .ssh/id_rsa.pub .ssh/authorized_keys
rm -rf .ssh/id_rsa
nano /etc/ssh/sshd_config
Port 65500 #set_custom_port
PasswordAuthentication no
PermitEmptyPasswords no
PermitRootLogin no
#add allow user@ip for connect to your server
AllowUsers user@allow_ip_1 user@allow_ip_2 user@allow_ip_3 user@allow_ip_4
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
sudo service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment