Skip to content

Instantly share code, notes, and snippets.

@yourdesigncoza
Created April 25, 2013 13:18
Show Gist options
  • Save yourdesigncoza/5459616 to your computer and use it in GitHub Desktop.
Save yourdesigncoza/5459616 to your computer and use it in GitHub Desktop.
It's best not to use the default port : 22 for ssh, create a new one and sleep better as most DDOS attacks are on port : 22
# Make server more secure by changing default ssh port
# No matter what you do keep your port number safe ... else ...
# IMPORTANT : add your own data or parameters, I make use of double segments [[ your variable ]]. eg. ssh root@[[ 96.172.44.11 ]] should be replaced with ssh root@888.88.88.88 where "888.88.88.88" is your value, variable etc. I have a habit of using ":::" to indicate line ending and end of paragraph, crazy I know but be warned its just how I write ::: All notes are for my own use & should you use any it's at your own risk, it's NOT a Tutorial :::
# Open the configuration file
nano /etc/ssh/sshd_config
# Find the following sections and change the information where applicable:
Port [[ 1234 ]]
Protocol 2
# Prevent root from login in
PermitRootLogin no
# Add to bottom of sshd_config add
UseDNS no
AllowUsers [[ your_user ]]
# Save and Exit
# Reload SSH, and it will implement the new ports and settings.
reload ssh
# To test the new settings (don’t logout of root yet), open a new terminal window and login as your new user.
ssh -p [[ new_port_number ]] [[ your_user ]]@[[ your_ip ]]
# Your prompt should now say:
[[[ your_user ]]@yourname ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment