Skip to content

Instantly share code, notes, and snippets.

@sati2013
Forked from benoitjpnet/migrateaacount.sh
Last active December 11, 2015 04:28
Show Gist options
  • Select an option

  • Save sati2013/4545048 to your computer and use it in GitHub Desktop.

Select an option

Save sati2013/4545048 to your computer and use it in GitHub Desktop.
for i in user1 user2 user3...
do
echo -n 'useradd -m -s /bin/bash -u '$(grep $i /etc/passwd | cut -d':' -f3) && echo -en ' \
-p' \'$(grep $i /etc/shadow | cut -d ':' -f2)\' $i '\n'
done
Output :
useradd -m -s /bin/bash -u USERID -p 'USERPWD' username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment