File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1111install () {
1212 apt-get update
1313 apt-get install -y --no-install-recommends openssh-server
14+ if grep ' ^PermitRootLogin' /etc/ssh/sshd_config
15+ then
16+ sed -i -e ' s/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
17+ else
18+ echo ' PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
19+ fi
20+ systemctl reload ssh
1421 }
1522
1623is_active ()
Original file line number Diff line number Diff line change 8383 is_docker || is_lxc || {
8484 chsh -s /usr/sbin/nologin " $WEBADMIN "
8585 passwd -l root
86- sed -i -e ' s/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
8786 }
8887
8988 # # NCP LAUNCHER
Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ if getent passwd "root" | grep -e '/usr/sbin/nologin'
77then
88 chsh -s /bin/bash root
99 passwd -l root
10- sed -i -e ' s/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
10+ if grep ' ^PermitRootLogin' /etc/ssh/sshd_config
11+ then
12+ sed -i -e ' s/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
13+ else
14+ echo ' PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
15+ fi
16+ systemctl reload ssh
1117fi
1218echo " done."
1319
You can’t perform that action at this time.
0 commit comments