Changing the SSH port from the default 22 is a good idea for a few reasons, and it will cut out the majority of bots trying to connect and keep your logs cleaner.
1.) Edit the /etc/ssh/sshd_config file with your preferred text editor.nano /etc/ssh/sshd_config
2.) Find the line that has "#port 22" and un-comment the line, then change 22 to the port you wish to use.
Change:#port 22
To:port 8340
Save the file. (With nano editor, press CTRL + X then Y to overwrite.)
3.) Restart the ssh service:
CentOS/Fedora/RHEL:systemctl restart sshd
or service sshd restart
Ubuntu/Debian:systemctl restart ssh
or service ssh restart
4.) If you use iptables or the standard Linux firewall, add a rule to allow traffic to the new SSH port. (If your firewall is empty, no need.)
Ubuntu/Debian:ufw allow 8340
CentOS/Fedora:firewall-cmd --permanent --zone=public --add-port=8340/tcp
firewall-cmd --reload
oriptables -A INPUT -i eth0 -p tcp --dport 8340 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 8340 -m state --state ESTABLISHED -j ACCEPT
熱門文章
Install ownCloud on CentOS 6
We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...
Install PPTP / PPP Proxy Server on CentOS 6
PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...
Install VNC Server and Desktop on CentOS 6
Install the desktop environment that we will use:yum groupinstall Desktop -yInstall the TigerVNC...
Setup Teamspeak 3 Server on Linux (CentOS)
If you run a gaming community, a Teamspeak 3 server is probably a popular choice for you to have...
Setup Plex Media Server on Linux CentOS 7
Looking for a home media server to stream movies, tv shows or music? Plex is a great solution....