1754745289

This commit is contained in:
2025-08-09 07:14:49 -06:00
parent a73e960869
commit e93abac372
3 changed files with 14 additions and 5 deletions
+9 -5
View File
@@ -4,8 +4,12 @@
[ "root" != "$USER" ] && exec sudo $0 "$@"
KEY="$2"
mkdir /home/$1/.ssh
echo $KEY >> /home/$1/.ssh/authorized_keys
chmod 700 /home/$1/.ssh
chmod 600 /home/$1/.ssh/authorized_keys
chown -R $1:$1 /home/$1/.ssh
if [ -d "/home/$1/.ssh" ]; then
echo "$KEY" >> "/home/$1/.ssh/authorized_keys"
else
mkdir "/home/$1/.ssh"
echo "$KEY" >> "/home/$1/.ssh/authorized_keys"
fi
chmod 700 "/home/$1/.ssh"
chmod 600 "/home/$1/.ssh/authorized_keys"
chown -R $1:$1 "/home/$1/.ssh"