forked from tilde/ssh-reg
darksider3
93e846e775
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/
23 lines
399 B
Bash
Executable file
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
|