One of the most tiresome aspects of sysadmin work are repeat tasks. It has been said that sysadmins are lazy by nature. I would have to agree. A good example is having to add or delete users from a Linux box. Adding one user at a time really isn't an issue if you only have one or two; however if you have several accounts to add it can become quite tedious.
I discovered the script called newusers which allows one to add several users at once, you simply need to setup a flat text file with a few parameters shown below:
Actually, you can provide all or just some of the parameters above. I chose to only provide a username, password, home directory, and shell. So you have the following ->
username:passwd::::homedir:$SHELL (Note the ::: represent blank field parameters.)
I simply stored all the users in a file
Another great script is the 'mkpasswd' as it creates a 9 random character passwd. Obviously, these scripts used in conjunction are a wonderful tools. They are particularly useful when setting up multiple user accounts on a new server.
As I have mentioned previously, when I setup new user accounts on a servers which I build for clients, I setup samba username and passwds.
In the process of setting up these samba accounts, I have encountered problems with the ubiquitous 'smbpasswd -a username' which basically adds new users to the samba database.
However, there are often times when 'smbpasswd' will not work as expected. There are tools that mitigate this problem. tdsam and pdbedit will also repair or create samba users for the samba database.
I will share some additional scripting measures for creating samba user accounts in a forthcoming blog entry