To easy the creation of users, I made a couple of bash scripts that do all the magic. They are located in the directory /usr/local/bin and are called add_backup_user.sh and remove_backup_user.sh. These users will be mounted on all tesla servers.
We can create a user, assign some groups, create its home directory, set a quota, store in the openldap database, all in one script. Example:
./add_backup_user.sh jsanctorum2 "Jonathan Sanctorum" email@example.com adam 500G ********
User jsanctorum2 with password *** will be created and given the homedir /data/home/jsanctorum2. the quota on this directory will be 500G, and the user will be part of the adam group. The complete name and an email address can be given as well. Run the command without any parameters to get some help.
./add_backup_user.sh Usage : ./add_backup_user.sh username fullname email extragroups quota password
extragroups can be more than one, separated by a colon(,) and without any spaces. Finally, this script will add some extra entries in openldap to enable automount for the homedir of the user.
removes the given user from openldap en destroys its dataset, with eventual data as well!!! handle with care!!!
root@sto3:/usr/local/bin# ./remove_backup_user.sh testuser2 removing user testuser2 and the dataset of the user data/home/testuser2 Are you sure you want to do this ? y y destroying dataset of user testuser2... cannot open 'data/home/testuser2': dataset does not exist removing automount entry from ldap database.... ldap_delete: No such object (32) matched DN: ou=auto.home,ou=automount,ou=adminm,dc=visielab,dc=be removing testuser2 from ldap database User does not exist: testuser2
In this example, the user testuser2 did not exist anymore. You get the necessary warnings and questions before the bash script does the removal.
./gen_pwd.sh generates random passwords, which includes a numerical and a capitalized character, 8 characters long.
root@sto3:/usr/local/bin# ./gen_pwd.sh Aeg2Supa Ohsho6go as7aeQui Lohs8cie aeL6Eis3 oa8Ahhae mi0aiS4U rahvo1Ch wah4Usuo me3eeWeu