-   Red Hat (
-   -   Bash for multiple accounts with auto-gen passwords (

vivchowd 01-31-2013 08:55 PM

Bash for multiple accounts with auto-gen passwords
I need a script to create bulk users in unix. I need some assistance from you for creating 100 or more User IDs using a bash script:

Here's my requirements:

1. I need to create 100 or even more user ids of different naming conventions. So, I would like to have a separate file(Example: usernames.txt) where I can paste the user ids, Name for Each ID, Group Name or GID, Serial Number) and call that file in the script

2. The script should contain the block of code that will auto-generate random 8-character long alphanumeric and mixed-case passwords without special characters or symbols(Something like < /dev/urandom tr -dc A-Za-z0-9_ | head -c8 ) for each ID and these system-generated passwords should be saved in a different file after the script is run. (Example: passwords.txt)

I googled but couldn't find a solid script for my above requirements.

chrism01 02-01-2013 01:27 AM

Well, this cmd may well be part of the soln, but for the rest, what have you done (code) so far?

vivchowd 02-01-2013 04:20 AM

Chris, I am not a pro at scripting. I am just trying several scenarios myself and even learning these from the scripts available online. So, if you can provide the script with some explanation, I'd appreciate it a lot.

vivchowd 02-01-2013 04:25 AM

Chris, I have found this link useful but the only disadvantage in this code is that we have to manually specify the passwords for bulk id creations in a file which wont even serve the motive of scripting. The script should auto generate passwords and provide the list of passwords(one per line) in a separate file for our later use.

All times are GMT -5. The time now is 09:57 PM.