更新 run.sh
This commit is contained in:
parent
147c5a5d7b
commit
a8e04396d1
12
run.sh
12
run.sh
@ -1,15 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PUB_KEY=$(curl -fsSL https://git.myprog.top/eric.keys)
|
PUB_KEY=$(curl -fsSL https://git.myprog.top/eric.keys)
|
||||||
if [ ! -f "${HOME}/.ssh/authorized_keys" ]; then
|
if [ ! -f "/root/.ssh/authorized_keys" ]; then
|
||||||
mkdir -p ${HOME}/.ssh/
|
mkdir -p /root/.ssh/
|
||||||
touch ${HOME}/.ssh/authorized_keys
|
touch /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${PUB_KEY}\n" > ${HOME}/.ssh/authorized_keys
|
echo -e "${PUB_KEY}\n" > /root/.ssh/authorized_keys
|
||||||
|
|
||||||
chmod 700 ${HOME}/.ssh/
|
chmod 700 /root/.ssh/
|
||||||
chmod 600 ${HOME}/.ssh/authorized_keys
|
chmod 600 /root/.ssh/authorized_keys
|
||||||
|
|
||||||
sudo sed -i "s@.*\(PasswordAuthentication \).*@\1no@" /etc/ssh/sshd_config
|
sudo sed -i "s@.*\(PasswordAuthentication \).*@\1no@" /etc/ssh/sshd_config
|
||||||
sudo sed -i 's/#\?PubkeyAuthentication \(yes\|no\)/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
sudo sed -i 's/#\?PubkeyAuthentication \(yes\|no\)/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user