小米设备软固化SSH时备份还原authorized_keys
This commit is contained in:
@@ -1321,6 +1321,7 @@ tools(){
|
|||||||
read -p "请输入需要还原的SSH密码(不影响当前密码,回车可跳过) > " mi_autoSSH_pwd
|
read -p "请输入需要还原的SSH密码(不影响当前密码,回车可跳过) > " mi_autoSSH_pwd
|
||||||
mi_autoSSH=已启用
|
mi_autoSSH=已启用
|
||||||
cp -f /etc/dropbear/dropbear_rsa_host_key $clashdir/dropbear_rsa_host_key 2>/dev/null
|
cp -f /etc/dropbear/dropbear_rsa_host_key $clashdir/dropbear_rsa_host_key 2>/dev/null
|
||||||
|
cp -f /etc/dropbear/authorized_keys $clashdir/authorized_keys 2>/dev/null
|
||||||
echo -e "\033[32m设置成功!\033[0m"
|
echo -e "\033[32m设置成功!\033[0m"
|
||||||
sleep 1
|
sleep 1
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ autoSSH(){
|
|||||||
}
|
}
|
||||||
#备份还原SSH秘钥
|
#备份还原SSH秘钥
|
||||||
[ -f $clashdir/dropbear_rsa_host_key ] && ln -sf $clashdir/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
|
[ -f $clashdir/dropbear_rsa_host_key ] && ln -sf $clashdir/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
|
||||||
|
[ -f $clashdir/authorized_keys ] && ln -sf $clashdir/authorized_keys /etc/dropbear/authorized_keys
|
||||||
}
|
}
|
||||||
host_lan(){
|
host_lan(){
|
||||||
[ -n "$(echo $host | grep -oE "([0-9]{1,3}[\.]){3}[0-9]{1,3}" )" ] && host_lan="$(echo $host | grep -oE "([0-9]{1,3}[\.]){3}")0/24"
|
[ -n "$(echo $host | grep -oE "([0-9]{1,3}[\.]){3}[0-9]{1,3}" )" ] && host_lan="$(echo $host | grep -oE "([0-9]{1,3}[\.]){3}")0/24"
|
||||||
|
|||||||
Reference in New Issue
Block a user