Add function to create a user with default password if it does not exist

This commit is contained in:
Bruno Tavares 2014-02-21 16:39:09 -03:00
parent 00f52c7336
commit b848aa5799

View File

@ -1,3 +1,7 @@
kickstart.user.create() {
kickstart.mute "id $1" || ( useradd -m -s /bin/bash -U -p `openssl passwd -1 $2` $1 )
}
kickstart.user.add_group() {
kickstart.info "Adding $2 group to $1"
grep -q $2 <(groups $1) || usermod -a -G $2 $1