Three steps to VPS Security (linux)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.