I want to add a user using a script: help

I want to add a user using a script: help

Post by cadi » Mon, 17 Aug 1998 04:00:00

I'm trying to start a script to add a user to /etc/passwd then start the
passwd to create the password. This on a redhat 5.1

I tried the expect language with no success

Here is the code.


spawn adduser testuser
spawn passwd testuser
expect "ssword:"
send "secret\r"
expect "ssword:"
send "secret"

You help would be extremly appreciated. I'm looking for a script to add user
though a html form.


1. Creating script to add new users w/o using USERADD command

Can anyone give me a few suggestion on the following scenario:

Creating the password should also be incorporated in the script. That
means, when you call the script to create a user, you also give it the
password value, and then, your script will create the user and also
create the password without prompting you for anything.

Assume the name of your script is create_users . Then the following

./create_users username uid gid initial_password user_information
home_directory default_shell

will create a user named smith, with UID 101, add to primary group
120, home directory /home/smith, information about the account being
"Alex Smith", with the bash shell as the default login shell and with
the initial password set to initpassvalue. A .profile file and a
.login file should automatically be copied into the home directory,
every time a user is created.

The system will incorporate the shadow password file. The password
should automatically have the default values for the following:

Any hints or examples? Thanks in advance.


2. Strange ppp activity, help...

3. ** Creating script to add new users w/o using USERADD **

4. postscript with latex

5. adding user using a script

6. compiled programs load very slow

7. Add/remove user to user group(s) in a script ??

8. HELP: ld-linux.so.2 missing!

9. Help: How do you add user from a script in Solaris

10. Help with script for adding large number of users

11. Add user that can add users?

12. Help on Changing user and executing commands using shell script

13. WANTED: Script for adding printer