【ansbile&SSH】Linux系统配置ssh监听多个端口方
2022-01-11 本文已影响0人
Bogon
# 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'