add custom file in sshd_config.d to override but not modify original config
parent
703c81a39c
commit
37ee37ef9a
10
initial.sh
10
initial.sh
|
@ -37,9 +37,13 @@ usermod -aG docker ${nml_user_name}
|
||||||
echo "${nml_user_name}:${password}" | chpasswd
|
echo "${nml_user_name}:${password}" | chpasswd
|
||||||
|
|
||||||
# 修改ssh端口和禁止root登陆
|
# 修改ssh端口和禁止root登陆
|
||||||
cp ${SSHCONF} ${SSHCONF}.bak
|
# cp ${SSHCONF} ${SSHCONF}.bak
|
||||||
sed -i "s/Port 22/Port ${new_port}/g" "${SSHCONF}"
|
# sed -i "s/Port 22/Port ${new_port}/g" "${SSHCONF}"
|
||||||
sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' "${SSHCONF}"
|
# sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' "${SSHCONF}"
|
||||||
|
cat > /etc/ssh/sshd_config.d/custom_sshd.conf << EOF
|
||||||
|
Port ${new_port}
|
||||||
|
PermitRootLogin yes
|
||||||
|
EOF
|
||||||
|
|
||||||
timedatectl set-timezone Asia/Shanghai
|
timedatectl set-timezone Asia/Shanghai
|
||||||
echo `date`
|
echo `date`
|
||||||
|
|
Loading…
Reference in New Issue