Editor: If you use windows System vps can see this article: http://www.bkjia.com/Article/201103/84875.html
1. Open a firewall
Enable the firewall and disable unnecessary ports
/Etc/init. d/iptables start // simple rules are as follows.
/Sbin/iptables-F
/Sbin/iptables-a input-p tcp-I vnet0-dport ssh-j ACCEPT
/Sbin/iptables-a input-p tcp-I vnet0-dport 80-j ACCEPT
/Sbin/iptables-a input-I vnet0-m state-state ESTABLISHED, RELATED-j ACCEPT
/Sbin/iptables-a input-p ICMP-j DROP
/Sbin/iptables-a input-I vnet0-j DROP
Several iptables are simple. After modification, restart iptables.
/Etc/init. d/iptables restart
Ii. Modify the ssh port
Note that the firewall should enable this port. In principle, it is recommended to change it to port 5000 or above.
Vi/etc/ssh/sshd_config // change the number following the search Port to the Port number you want. Delete it if there is a # number before the Port.
3. Prohibit root Login
Be sure to create a common user first, otherwise it will be tragic.
Vi/etc/ssh/sshd_config // search for PermitRootLogin and change "yes" to "no". If there is a # sign in front, delete it.
Second, restart ssh after completing step 3.
Service sshd restart