Want to create new users without using "useradd" command and user Interaction.

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Want to create new users without using "useradd" command and user Interaction.
# 1  
Old 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.

Last edited by syedifti; 10-06-2001 at 04:15 PM..
# 2  
Old 10-08-2001
use the useradd program as it was intended to do. the only problem your haveing is adding in a default password.

man passwd there should be a switch to set the password to blank & prompt the user to enter in a password @ first login.


use useradd to add the users.

then edit the new entries in the shadow file w/ a default password salt.
# 3  
Old 10-09-2001
useradd does have the ability to set a default password. This from the manpage:
-p passwd
     The  encrypted  password, as returned by crypt(3).
     The default is to disable the account.

So, if you can set up one user, add a password via the passwd command, copy and paste the password to useradd, you should be set. Example:

# useradd ashley
# passwd ashley
New password: qwerty
Re-enter new password: qwerty
Password changed.
# grep ^ashley /etc/shadow
# useradd -p'$1$/weovkcV$0h0RiE8lfc/qpBa60cV1p/' newashley

Of course, this is a rudimentry example, with a weak password and default options... you would definitely want the user to have to change the password upon logging in for the first time... Also, as a note, this example would be using md5 passwords. This may not be compatible with your setup.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to run root level command , if user has "su -" permission in sudoers provided?

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

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

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

3. Shell Programming and Scripting

Short command to create two files >{respo,nd}.php (with "tee" command?)

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

4. Red Hat

Fedora 19 "useradd" failure, GUI success

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

5. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

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

6. Homework & Coursework Questions

how to create new options of "dd command" using bash script?

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

7. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

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

8. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

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

9. Shell Programming and Scripting

communicating wth another user aside from "wall" and "write"

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

10. UNIX for Dummies Questions & Answers

Create new user with exisiting "id"

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
Login or Register to Ask a Question