From a8e04396d16ca5d87f9847255d44ef1339b90a3d Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 27 Dec 2024 11:45:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20run.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index e76f044..9af93dd 100644 --- a/run.sh +++ b/run.sh @@ -1,15 +1,15 @@ #!/bin/bash PUB_KEY=$(curl -fsSL https://git.myprog.top/eric.keys) -if [ ! -f "${HOME}/.ssh/authorized_keys" ]; then - mkdir -p ${HOME}/.ssh/ - touch ${HOME}/.ssh/authorized_keys +if [ ! -f "/root/.ssh/authorized_keys" ]; then + mkdir -p /root/.ssh/ + touch /root/.ssh/authorized_keys fi -echo -e "${PUB_KEY}\n" > ${HOME}/.ssh/authorized_keys +echo -e "${PUB_KEY}\n" > /root/.ssh/authorized_keys -chmod 700 ${HOME}/.ssh/ -chmod 600 ${HOME}/.ssh/authorized_keys +chmod 700 /root/.ssh/ +chmod 600 /root/.ssh/authorized_keys sudo sed -i "s@.*\(PasswordAuthentication \).*@\1no@" /etc/ssh/sshd_config sudo sed -i 's/#\?PubkeyAuthentication \(yes\|no\)/PubkeyAuthentication yes/' /etc/ssh/sshd_config