###修改端口
grep Port /etc/ssh/sshd_config sed -i ‘/#Port 22/aPort 52113‘ /etc/ssh/sshd_config grep Port /etc/ssh/sshd_config
###禁止root用户登录
grep ‘PermitRootLogin yes‘ /etc/ssh/sshd_config sed -i ‘/#PermitRootLogin yes/aPermitRootLogin no‘ /etc/ssh/sshd_config grep ‘PermitRootLogin‘ /etc/ssh/sshd_config
###禁止空密码登录
grep ‘PermitE‘ /etc/ssh/sshd_config sed -i ‘/#PermitEmptyPasswords no/aPermitEmptyPasswords yes‘ /etc/ssh/sshd_config grep ‘PermitE‘ /etc/ssh/sshd_config
##优化 ssh连接过慢,DNS轮询导致的问题:
grep ‘UseDNS‘ /etc/ssh/sshd_config sed -i ‘/#UseDNS yes/aUseDNS no‘ /etc/ssh/sshd_config grep ‘UseDNS‘ /etc/ssh/sshd_config
###GSSAPIAuthentication,这个作用是为了时ssh连接更加快
grep ‘GSSAPIAuthentication‘ /etc/ssh/sshd_config sed -i ‘s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g‘ /etc/ssh/sshd_config grep ‘GSSAPIAuthentication‘ /etc/ssh/sshd_config
原文:http://lvnian.blog.51cto.com/7155281/1712524