Computing.Net > Forums > Linux > Script to automate adding users

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script to automate adding users

Reply to Message Icon

Name: David Wiley
Date: February 25, 2002 at 19:26:02 Pacific
Comment:

Create a script that would automate adding users. The script SHOULD NOT use the functionality "useradd" that comes with the system, to create users. Each user should be added manually

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.

Ex:

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

./create_users smith 1001 120 initpassvalue "Alex Smith" /home/smith /bin/bash

./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:

passwd length should be at least 8 characters

The password should be valid for 3 months


Can anyone provide any clues or hints for me?



Sponsored Link
Ads by Google

Response Number 1
Name: hena
Date: February 26, 2002 at 00:25:35 Pacific
Reply:

Just curious. Why do you want this? I mean
useradd is basicly what you ask. You can
give it all that and it does what you want.


0

Response Number 2
Name: stefan caunter
Date: February 26, 2002 at 19:56:11 Pacific
Reply:

users cannot be added unless useradd is called.
what you want is to ease the process of building the arguments to useradd's options.
just read the name, password, shell, whatever into variables and plug them into the big command at the end. piece of cake.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Script to automate adding users

Script to kill Linux user processes www.computing.net/answers/linux/script-to-kill-linux-user-processes/29972.html

help writing script to read files n www.computing.net/answers/linux/help-writing-script-to-read-files-n/27648.html

Shell scripting to get System Info. www.computing.net/answers/linux/shell-scripting-to-get-system-info/19972.html