The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To give the "unzip" permissions & "create" file permissions Mike1234 HP-UX 3 03-02-2008 05:34 PM
communicating wth another user aside from "wall" and "write" Deanne Shell Programming and Scripting 6 05-11-2007 06:43 AM
Unix "at" / "Cron" Command New Problem...Need help Mohanraj UNIX for Dummies Questions & Answers 3 01-26-2006 08:08 PM
Create new user with exisiting "id" miredale UNIX for Dummies Questions & Answers 2 01-25-2006 07:17 AM
"ap" command not dumping user profiles rm -r * UNIX for Dummies Questions & Answers 0 08-31-2005 12:44 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-06-2001
syedifti syedifti is offline
Registered User
  
 

Join Date: Oct 2001
Posts: 13
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..
  #2 (permalink)  
Old 10-08-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
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.

OR

use useradd to add the users.

then edit the new entries in the shadow file w/ a default password salt.
  #3 (permalink)  
Old 10-09-2001
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
useradd does have the ability to set a default password. This from the manpage:
Code:
-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:

Code:
# useradd ashley
# passwd ashley
New password: qwerty
Re-enter new password: qwerty
Password changed.
#
# grep ^ashley /etc/shadow
ashley:$1$/weovkcV$0h0RiE8lfc/qpBa60cV1p/:11604:0:99999:7:::
#
# 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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0