diff --git a/docker/base/amd64/Dockerfile b/docker/base/amd64/Dockerfile index fefdf1dd..24288a06 100644 --- a/docker/base/amd64/Dockerfile +++ b/docker/base/amd64/Dockerfile @@ -23,7 +23,6 @@ RUN \ RUN \ /usr/bin/ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ - echo 'root:Hello1234' | chpasswd && \ groupadd -r admin && useradd -g admin admin && \ yum install -y man && \ yum install -y dstat && \ @@ -39,6 +38,8 @@ RUN \ ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \ sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd && \ sed -i -e 's/^#Port 22$/Port 2222/' /etc/ssh/sshd_config && \ + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config && \ + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config && \ mkdir -p /root/.ssh && chown root.root /root && chmod 700 /root/.ssh && \ yum install -y cronie && \ sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \ diff --git a/docker/base/arm64/Dockerfile b/docker/base/arm64/Dockerfile index f4b1ce25..db4e5a62 100644 --- a/docker/base/arm64/Dockerfile +++ b/docker/base/arm64/Dockerfile @@ -23,7 +23,6 @@ RUN \ RUN \ /usr/bin/ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ - echo 'root:Hello1234' | chpasswd && \ groupadd -r admin && useradd -g admin admin && \ yum install -y man && \ yum install -y dstat && \ @@ -39,6 +38,8 @@ RUN \ ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \ sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd && \ sed -i -e 's/^#Port 22$/Port 2222/' /etc/ssh/sshd_config && \ + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config && \ + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config && \ mkdir -p /root/.ssh && chown root.root /root && chmod 700 /root/.ssh && \ yum install -y cronie && \ sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \