Centos 6.6 最小安裝筆記(2) 設定好 sshd
http://wiki.centos.org/HowTos/Network/SecuringSSH
0- 啟動 eth0 後,先 yum -y upgrade
1- 參考 http://preview.tinyurl.com/oasxl8b
2- 修改有關設定
2-1 修改 sshd 的 port
2-2 禁止 root 登入
2-3 指定 user 可以經 sshd 具有 root
SSH 服務的設定檔 /etc/ssh/sshd_config
[root@localhost ~] # vi /etc/ssh/sshd_config Port 3322 PermitRootLogin no UseDNS no AllowUsers yenpai jess [root@localhost ~] # service sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ] [root@localhost ~] # |
[root@localhost ~] # netstat -ant | grep :3322 tcp 0 0 0.0.0.0:3322 0.0.0.0:* LISTEN tcp 0 0 :::3322 :::* LISTEN |
[root@localhost ~] # adduser yenpai [root@localhost ~] # passwd yenpai Changing password for user yenpai. New password: Retype new password: passwd: all authentication tokens updated successfully. [root@localhost ~] # service shhd restart |
3- 修改 iptablles 設定,讓指定port能對外通訊。
iptables -I INPUT -p tcp --dport 3322 -j ACCEPT
iptables -I OUTPUT -p tcp --sport 3322 -j ACCEPT
service iptables save
service iptables reload
沒有留言:
張貼留言