美文网首页
【ansbile&SSH】Linux系统配置ssh监听多个端口方

【ansbile&SSH】Linux系统配置ssh监听多个端口方

作者: Bogon | 来源:发表于2022-01-11 23:12 被阅读0次

    # ansible -i hosts all -m shell -a "sed -i 's/Port 18822/# Port 18822/g' /etc/ssh/sshd_config"

    # ansible  -i hosts all -m shell -a  "sed  -i  's/ListenAddress 0.0.0.0/# ListenAddress 0.0.0.0/g'  /etc/ssh/sshd_config"

    # ansible  -i hosts all -m shell -a  'echo  "ListenAddress 0.0.0.0:18822"  >>  /etc/ssh/sshd_config'

    # ansible  -i hosts all -m shell -a  'echo  "ListenAddress 0.0.0.0:22"  >>  /etc/ssh/sshd_config'

    # ansible  -i hosts all -m shell -a  'systemctl restart sshd'

    相关文章

      网友评论

          本文标题:【ansbile&SSH】Linux系统配置ssh监听多个端口方

          本文链接:https://www.haomeiwen.com/subject/genicrtx.html