|
1
|
sed -i '2 ioldboy\noldgirl' sshd_config
|
|
1
|
[root@oldboy ssh]# sed -i '13 iPort 52113\nPermitRootLogin no\nPermitEmptyPasswords no\nUseDNS no\nGSSAPIAuthentication no' sshd_config
|
|
1
2
3
4
5
6
|
[root@oldboy ssh]# sed -n '13,17p' sshd_config
Port 52113PermitRootLogin noPermitEmptyPasswords noUseDNS noGSSAPIAuthentication no |
|
1
2
3
4
5
6
7
8
|
echo "#--------sshConfig修改ssh默认登录端口,禁止root登录----------------------------#"
\cp /etc/ssh/sshd_config /etc/ssh/sshd_config.$(date +"%F"-$RANDOM)
sed -i 's%#Port 22%Port 52113%' /etc/ssh/sshd_config
sed -i 's%#PermitRootLogin yes%PermitRootLogin no%' /etc/ssh/sshd_config
sed -i 's%#PermitEmptyPasswords no%PermitEmptyPasswords no%' /etc/ssh/sshd_config
sed -i 's%#UseDNS yes%UseDNS no%' /etc/ssh/sshd_config
sed -i 's%GSSAPIAuthentication yes%GSSAPIAuthentication no%' /etc/ssh/sshd_config
egrep "UseDNS|52113|RootLogin|EmptyPass|GSSAPIAuthentication" /etc/ssh/sshd_config
|
|
1
|
sed -i '2735s/admin_tenant_name=service/admin_tenant_name=admin/' nova.conf
|