Docs/shell/safe/05-sshd.sh
2022-10-18 16:59:37 +08:00

10 lines
384 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# sshd端口
sed -i "/^#Port 22/a\Port $ssh_port" /etc/ssh/sshd_config
# 限制root用户远程
sed -i '/#PermitRootLogin yes/a\PermitRootLogin no' /etc/ssh/sshd_config
# 限制管理用户与应用用户登录。允许manager登录允许appl_user通过ip_ssh登录
sed -i "\$a\AllowUsers $manager $appl_user@$ip_ssh" /etc/ssh/sshd_config
/bin/systemctl restart sshd