首页 > 代码库 > centos

centos

/etc/sysconfig/network-scripts/ifcfg-eth0

IPADDR=x.x.x.x

GATEWAY=y.y.y.y

NETMASK=x.x.x.x

yum -y install openssh-server openssh-clients

chkconfig sshd on

service sshd start

netstat -tulpn | grep :22

vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

If you want to restict access to 192.168.1.0/24, edit it as follows:
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 22 -j ACCEPT
If your site uses IPv6, and you are editing ip6tables, use the line:
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 22 -j ACCEPT

 service iptables restart

 

service iptables save
service iptables stop
chkconfig iptables off

visudo

an      ALL=(ALL)       ALL

yum install gcc gcc-c++