Skip to content

Instantly share code, notes, and snippets.

@tonejito
Last active October 11, 2017 20:04
Show Gist options
  • Select an option

  • Save tonejito/279f7235d4c1865c23602325063d4f89 to your computer and use it in GitHub Desktop.

Select an option

Save tonejito/279f7235d4c1865c23602325063d4f89 to your computer and use it in GitHub Desktop.
#!/bin/bash
PREFIX=user
for NUMBER in {00..09}
do
NAME="${PREFIX}${NUMBER}"
# Genera la sal aleatoriamente desde /dev/urandom
SALT=$(dd if=/dev/urandom bs=1 count=6 2>/dev/null | base64)
PW="`mkpasswd -m sha-256 'password'${NUMBER} ${SALT}`"
useradd \
--password "${PW}" \
--create-home \
--home-dir=/home/$NAME \
--shell=/bin/bash \
--gid users \
$NAME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment