Is there a way to add a single user and password using parameters from the
command line?

I've set up a script for a user to add users, create directories, set
permissions, etc.  I have the user type in "usersetup <username> <password>". 
This adds the user, creates some subdirectories, changes ownerships and
changes permissions.

The one thing I was unable to do was to set the password without intervention
when the user was added.

I finally settled on this method in the script:

echo $password > /usr/local/sbin/user
passwd --stdin $user < /usr/local/sbin/user
rm /usr/local/sbin/user

Is there a better way of doing this?  I don't like writing the password out to
the hard drive, even if I delete it a second later.  I was just unable to find
another way to do it that didn't require input from the user after the initial
invocation of the script.

The idea is to make this as simple for the user as possible.  I only need to
add one user and set his password at a time.  Perhaps there's a way to get the
passwd command to recognize a memory variable as "stdin".

Any help would be appreciated.

Thanks.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to