10 lines
384 B
Bash
10 lines
384 B
Bash
#!/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
|