#!/bin/bash
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
read -p "Port(22):" port
sed -i "13c Port ${port}" /etc/ssh/sshd_config
read -p "LoginGraceTime(s/m/h):" LoginGraceTime
sed -i "41c LoginGraceTime ${LoginGraceTime}" /etc/ssh/sshd_config
read -p "PermitRootLogin(yes/no):" PermitRootLogin
sed -i "42c PermitRootLogin ${PermitRootLogin}" /etc/ssh/sshd_config
read -p "UseDNS(yes/no):" UseDNS
sed -i "122c UseDNS ${UseDNS}" /etc/ssh/sshd_config
read -p "PrintMotd(yes/no):" PrintMotd
case $PrintMotd in
yes)
sed -i "112c PrintMotd ${PrintMotd}" /etc/ssh/sshd_config
read -p "Prompt message:" message
echo "${message}" > /etc/motd
;;
no)
sed -i "112c PrintMotd ${PrintMotd}" /etc/ssh/sshd_config
;;
esac
/etc/init.d/sshd restart &>>/dev/null本文出自 “何阳光” 博客,请务必保留此出处http://heyangguang.blog.51cto.com/10930823/1894391
原文:http://heyangguang.blog.51cto.com/10930823/1894391