1
|
cat
/etc/passwd
|
1
2
|
cat
/etc/passwd
|
awk
-F:
'$3==0'
//
列出具有超级权限的用户
cat
/etc/passwd
|
grep
'/bin/bash'
//
列出具有登录shell的用户
|
1
|
chkconfig --list |
grep
"3:on"
|
1
|
chkconfig
|
1
|
test
ALL=(ALL) NOPASSWD: ALL
|
1
|
PermitRootLogin no
|
1
|
sed
-i
's/\(PermitRootLogin\) yes/\1 no/'
/etc/ssh/sshd_config
|
1
|
PasswordAuthentication no
|
1
|
sed
-i
's/\(PasswordAuthentication\) yes/\1 no/'
/etc/ssh/sshd_config
|
1
|
#Port 22
|
1
|
Port 28536
|
1
|
service sshd restart
|
1
2
3
|
iptables -F
iptables -X
iptabels -Z
|
1
2
3
|
iptables -A INPUT -p tcp -m tcp --dport 28536 -j ACCEPT
//
允许
ssh
的端口通过
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
//
允许已建立的和服务器发起的数据包通过
iptables -P INPUT DROP
//
丢弃所有未允许通过的数据包
|
1
|
service iptables save
|
1
2
|
chkconfig sshd on
chkconfig iptables on
|