Skip to content

Instantly share code, notes, and snippets.

@benharri
Last active Nov 19, 2018
Embed
What would you like to do?
# 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