Skip to content

Instantly share code, notes, and snippets.

@ahmad-mushtaq
Created May 9, 2015 10:50
Show Gist options
  • Save ahmad-mushtaq/b4933176cf1521eac820 to your computer and use it in GitHub Desktop.
Save ahmad-mushtaq/b4933176cf1521eac820 to your computer and use it in GitHub Desktop.
Edit (as root) /etc/ssh/sshd_config. Append the following to it:
Port 1234
PermitRootLogin no
AllowUsers jim
Port 1234 causes SSH to listen on port 1234. You can use any unused port from 1 to 65535. It's recommended to choose a privileged port (port 1-1024) which can only be used by root. If your SSH daemon stops working for some reason, a rogue application can't intercept the connection. PermitRootLogin disallows direct root login. AllowUsers jim allows user jim to login through SSH. If you do not have to login from everywhere, you can make this more secure by restricting jim to an IP address (replace 1.2.3.4 with your actual IP address): AllowUsers jim@1.2.3.4 Changes to the configuration file /etc/ssh/sshd_config are not immediately applied, to reload the configuration, run: sudo service ssh reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment