Last active
November 9, 2020 17:48
-
-
Save huehnerhose/d1bc4ec8cd5e478eb9dbb2d3365afc23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo Username | |
read username | |
echo GroupAdds - comma separated group list | |
read groups | |
# be sure password database to be in sync | |
pwd_mkdb -p /etc/master.passwd | |
pw useradd -n $username -s /usr/local/bin/zsh -G $groups -m -w random | |
mkdir /home/$username/.ssh | |
echo PublicKey | |
read pubkey | |
echo $pubkey > /home/$username/.ssh/authorized_keys | |
chmod 700 /home/$username/.ssh | |
chmod 600 /home/$username/.ssh/authorized_keys | |
chmod -x /home/$username/.ssh/authorized_keys | |
chown -R $username:$username /home/$username/.ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment