ssh-reg/private/scripts/make-tilde-user.sh
darksider3 93e846e775 Big restructure of all directories:
config regarding ssh-reg into ssh-reg repository,
config regarding ssh and logins itself into config/etc

administrate.py to private/
userapplications.py to public/
scripts to private/scripts/
2019-09-23 23:17:21 +02:00

23 lines
399 B
Bash
Executable file

#!/bin/env bash
USERNAME=$1
REALNAME=$2
EMAIL=$3
PUBKEY=$4
adduser $USERNAME
# empty password
usermod --lock $USERNAME
# add to tilde group
usermod -a -G tilde $USERNAME
# paste ssh key
mkdir /home/$USERNAME/.ssh
echo $PUBKEY >/home/$USERNAME/.ssh/authorized_keys
# fix perms
chmod -Rv 700 /home/$USERNAME/.ssh/
chown -Rv $USERNAME:$USERNAME /home/$USERNAME/.ssh/
echo "user created."
return 0