hi folks,
long ago i made a script for adding mass of users and one for changing passwords.
The first (smbaddnewusers) creates users in BSD or linux (also CentOS with SeLinux security) and for samba,
also creates the specified home directory and adjust SeLinux attributes,
the second one (smbchangepwd) changes the passwords for specified users (also for samba).
Place all files in /root/data/scripts/ and chmod this directory to 700
You can change the user directories according your environment in scripts.
Until now i used these scripts for creating Thousands of users or changing passwords, both in OpenBSD and Linux.
First you need to create a text file with all parameters and place it in /root/data/scripts/conf.newusers.cfg (chmod 700).
You can do this in linux with LibreOffice (or OpenOffice) Calc (see examples in attachment)
sample config file for smbaddnewusers
Code:
# /root/data/scripts/conf.newusers.cfg
# first you have to create this new users file!
# you can do this under Unix with LibreOffice (OpenOffice) Calc and export as csv in UTF-8 with separator ";"
# see example conf.newusers.ods
# format of conf.newusers.cfg in /root/data/scripts (chmod 700)
# # first char # specifies a comment line
# #login1;pwd2;uid3;gid4;comment5;homedir6;shell7;groups8
# admin;secretpassword;500;500;unix admin;/home/admin;/usr/local/bin/bash;users,wheel,someothergroup
admin;securepassword;501;501;IT Administrator;/home/admin;/usr/local/bin/bash;users,wheel
tom;securepassword;502;502;Tom admin;/home/tom;/usr/local/bin/bash;users,wheel,group-it,group-pub,group-team,,group-db
dave;securepassword;503;503;Dave Thorn;/data/share/usr/home/dave;/sbin/nologin;users,group-pub,group-team,group-db
john;securepassword;504;504;John Deer;/data/share/usr/home/john;/sbin/nologin;users,group-pub,group-team
#
sample config file for smbchangepwd
Code:
# /root/data/scripts/conf.changepwd.cfg
# first you have to create this users file!
# you can do this under Unix with LibreOffice (OpenOffice) Calc and export as csv in UTF-8 with separator ";"
# see example conf.changepwd.ods
# format of conf.changepwd.cfg in /root/data/scripts (chmod 700)
# # first char # specifies a comment line
# #username;newpassword
admin;newsecretpassword
#
Attachments:
smbaddnewusers - bash script, so bash has to be installed!
smbchangepwd - bash script, so bash has to be installed!
conf.sample.cfg (1) - sample config file for creating users including their home directory
conf.sample.cfg (2) - sample config for changing unix and samba passwords
#
i can't upload following files, if you are interested, send me your email adress.
conf.newusers.ods - conf.newusers.cfg as LibrOffice file
conf.changepwd.ods - conf.changepwd.cfg as LibrOffice file