10-06-2001
Want to create new users without using "useradd" command and user Interaction.
Don't want to use useradd command to create a new user
I am doing manual addition of accounts. Actually I am writing a script and I am working on RedHat7.1 system. What I am trying to do is run the script and pass all the values of the username password and group as command line parameters. Now what I am trying to do is after passing the initial password I want the account to be activated with that password. Because if you simply edit the passwd file and add the username, password and other information when you test the account it does not recognize the account and then as a root user you have to go and enter the password again and then it gets written to the shadow file in encrypted form(even if you use command "pwconv" does not write the password to the shadow file in the encrypted form). Plus I can't leave the acconts open either. To create 500 account or more It will take me a long time to create those accounts. I just want to automate those password writing to the shadow file without having to go through this command
passwd "username"
enter new password in Unix ******
So, if anyone knows how can I do this through the script please let me know.
regards
Last edited by syedifti; 10-06-2001 at 04:15 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How can I change a user account to reflect the same "id" as another account?
for example
user test has an id of 2003
user test2 has a id of 2989
I want to change user test2 to have an id of 2003
Thanks
Mark (2 Replies)
Discussion started by: miredale
2 Replies
2. Shell Programming and Scripting
Hi,
Can anyone suggest a Unix command or c-shell algorithm to simulate to behavior of "wall" command minus the "all users"? What I'm trying to do is to send a notice to just one particular user but i dont want other remotely-logged-on users to receive the message (on the pseudo-terminals). I... (6 Replies)
Discussion started by: Deanne
6 Replies
3. Shell Programming and Scripting
Hi!!..
I would like to know what is maximum character size for a command in the "sh" or "bourne" shell?
Thanks in advance..
Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies
4. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
5. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Creating bash script the dd command and its new options (-l -U)
-l options to lowercase contents of file
-U... (2 Replies)
Discussion started by: katherineskye1
2 Replies
6. UNIX for Dummies Questions & Answers
Please can you help me understand the significance of providing arguments under sh -s in
> ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies
7. Red Hat
Hey guys/gals,
I have a Fedora 19 box with a 26TB RAID set mounted as my home directory
# mount|grep home
/dev/md0 on /home type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=128k,sunit=256,swidth=3584,noquota)
I have been able to add/modify user accounts using VNC +... (4 Replies)
Discussion started by: jjinno
4 Replies
8. Shell Programming and Scripting
08:29 < xsi> >{respo,nd}.php bash: {respo,nd}.php: ambiguous redirect
08:31 < geirha> xsi: maybe you want tee
So I was advised to do so. And I can't create two OR MORE files at once with {a,b,c,d,e,f}.php
(which I quickly now need to create and to learn to create in the future to quickly... (2 Replies)
Discussion started by: Xcislav
2 Replies
9. UNIX for Dummies Questions & Answers
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
10. UNIX for Beginners Questions & Answers
I am looking t run root level command on multiple servers, but all servers have only "su - " permission available in sudoers.
please help me if any way that I can run command using help of "su -"
My script
for hosts in `cat hosts.txt`;
do
echo "###########################Server Name-... (5 Replies)
Discussion started by: yash_message
5 Replies
useradd(8) System Manager's Manual useradd(8)
NAME
useradd - create a new user account
SYNOPSIS
useradd [-D binddn] [-P path] [-c comment] [-d homedir]
[-e expire] [-f inactive] [-G group,...] [-g gid]
[-m [-k skeldir]] [-o] [-p password] [-u uid]
[-U umask] [-r] [-s shell] [--service service] [--help]
[--usage] [-v] [--preferred-uid uid] account
useradd --show-defaults
useradd --save-defaults [-d homedir] [-e expire] [-f inactive]
[-g gid] [-G group,...] [-k skeldir] [-U umask] [-s shell]
DESCRIPTION
useradd creates a new user account using the default values from /etc/default/useradd and the specified on the command line. Depending on
the command line options the new account will be added to the system files or LDAP database, the home directory will be created and the
initial default files and directories will be copied.
The account name must begin with an alphabetic character and the rest of the string should be from the POSIX portable character class ([A-
Za-z_][A-Za-z0-9_-.]*[A-Za-z0-9_-.$]).
OPTIONS
-c, --comment comment
This option specifies the users finger information.
-d, --home homedir
This option specifies the users home directory. If not specified, the default from /etc/default/useradd is used.
-e, --expire expire
With this option the date when the account will be expired can be changed. expiredate has to be specified as number of days since
January 1st, 1970. The date may also be expressed in the format YYYY-MM-DD. If not specified, the default from /etc/default/useradd
is used.
-f, --inactive inactive
This option is used to set the number of days of inactivity after a password has expired before the account is locked. A user whose
account is locked must contact the system administrator before being able to use the account again. A value of -1 disables this
feature. If not specified, the default from /etc/default/useradd is used.
-G, --groups group,...
With this option a list of supplementary groups can be specified, which the user should become a member of. Each group is separated
from the next one only by a comma, without whitespace. If not specified, the default from /etc/default/useradd is used.
-g, --gid gid
The group name or number of the user's main group. The group name or number must refer to an already existing group. If not speci-
fied, the default from /etc/default/useradd is used.
-k, --skel skeldir
Specify an alternative skel directory. This option is only valid, if the home directory for the new user should be created, too. If
not specified, the default from /etc/default/useradd or /etc/skel is used.
-m, --create-home
Create home directory for new user account.
-o, --non-unique
Allow duplicate (non-unique) User IDs.
-p, --password password
Encrypted password as returned by crypt(3) for the new account. The default is to disable the account.
-U, --umask umask
The permission mask is initialized to this value. It is used by useradd for creating new home directories. The default is taken from
/etc/default/useradd.
-u, --uid uid
Force the new userid to be the given number. This value must be positive and unique. The default is to use the first free ID after
the greatest used one. The range from which the user ID is chosen can be specified in /etc/login.defs.
--preferred-uid uid
Set the new userid to the specified value if possible. If that value is already in use the first free ID will be chosen as described
above.
-r, --system
Create a system account. A system account is an user with an UID between SYSTEM_UID_MIN and SYSTEM_UID_MAX as defined in
/etc/login.defs, if no UID is specified. The GROUPS entry in /etc/default/useradd is ignored, too.
-s, --shell shell
Specify user's login shell. The default for normal user accounts is taken from /etc/default/useradd, the default for system accounts
is /bin/false.
--service service
Add the account to a special directory. The default is files, but ldap is also valid.
-D, --binddn binddn
Use the Distinguished Name binddn to bind to the LDAP directory. The user will be prompted for a password for simple authentica-
tion.
-P, --path path
The passwd and shadow files are located below the specified directory path. useradd will use this files, not /etc/passwd and
/etc/shadow.
--help Print a list of valid options with a short description.
--usage
Print a short list of valid options.
-v, --version
Print the version number and exit.
FILES
/etc/passwd - user account information
/etc/shadow - shadow user account information
/etc/group - group information
/etc/default/useradd - default values for account creation
/etc/skel - directory containing default files
SEE ALSO
passwd(1), login.defs(5), passwd(5), shadow(5), userdel(8), usermod(8)
AUTHOR
Thorsten Kukuk <kukuk@suse.de>
pwdutils May 2010 useradd(8)