This commit is contained in:
陆柯 2023-04-04 18:37:19 +08:00
parent 83dc20e502
commit f4e34edd04

View File

@ -105,7 +105,7 @@ then
# 由 root 指定新用户而创建的配置文件的 owner 是 root而不是新用户导致新用户无法读取该文件而密钥登录失败因此要重设 owner。
chown $TheUser:$TheUser $HomePath/.ssh
fi
if [ -e "$HomePath/.ssh/authorized_keys" ]
if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]
then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date +%Y%m%dT%H%M%S)
fi