Skip to content

Instantly share code, notes, and snippets.

@benharri
Last active November 19, 2018 21:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benharri/2a515dbde2dfdf3294dffe7b1be56e67 to your computer and use it in GitHub Desktop.
# on tilde.team as root
unshadow /etc/passwd /etc/shadow > linux_passwd
cat linux_passwd | awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", $1,$2,$3,$4,$5,$6,$7); }' > new_passwd
# edit new_passwd to include only new users
# now on bsd box, switch to root shell
scp tilde.team:/root/new_passwd .
cat new_passwd >> /etc/master.passwd
pwd_mkdb -p /etc/master.passwd
for user in $(cut -d : -f 1 < new_passwd); do
mkdir -p /home/$user/.ssh
scp tilde.team:/home/$user/.ssh/authorized_keys /home/$user/.ssh/
chown -R $user:team /home/$user
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment