Well, thank you, Tom and Keith. I've checked the man page of 'passwd' and it actually has the option '--stdin', which tells the command to accept the new password from standard input just once; making it easy to automate things.
Oops, my bad. The second line of your script said passwd and I saw useradd again. If you don't allow user interactive logins, you could use a SUID root script or just run it as root. But if you are trying to delegate some root functions to other interactive users, sudo is usually better.
Expanding on your first idea...you can set up a script that emulates the wheel group in FreeBSD by using the wheel group in Red Hat. For example, create your script in /usr/bin and set the ownership to root:wheel, permissions to rwsr-x---. Then, add the users allowed to run it to the wheel group and they will be able to run the script as root, while normal users can't run it at all.
Best Regards, Keith -- LPIC-2, MCSE, N+ Droplets of yes and no in an ocean of maybe Got spam? Get spastic http://spastic.sourceforge.net
-- Psyche-list mailing list Psyche-list@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/psyche-list