This commit is contained in:
陆柯 2022-11-18 16:58:03 +08:00
parent c0c4adefc4
commit d7f44ba319

View File

@ -76,7 +76,7 @@ then
mkdir -p $HomePath/.ssh
chmod 700 $HomePath/.ssh
# 注意,由 root 为新用户创建的配置文件的 owner 是 root而不是新用户导致新用户无法读取该文件而密钥登录失败因此要重设 owner。
chown $2:$2 $HomePath
chown $TheUser:$TheUser $HomePath/.ssh
if [ -e '$HomePath/.ssh/authorized_keys' ]
then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date +%Y%m%d%H%M%S)