LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-05-2008, 01:44 AM   #1
Ingenico1
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
How to add new user via shell script


Hi !

I have to add new user with password using shell script(using only adduser command not useradd), I need to read user name & password from the file.

Thanks for help.
 
Old 02-05-2008, 01:59 AM   #2
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 36
I think the adduser is already a script which uses the useradd command.

I think it quite hard to write a script to use the adduser and not the useradd.

I think python would be nice for this kind of work.
Read a line from file, check the line for errors, use system command IIRC to use the useradd to add the user, read next line of file ...
 
Old 02-06-2008, 02:41 AM   #3
Ingenico1
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Hi

I use, reading password from the file AddPassword

adduser -g GroupName -h /home/Marad100 Marad100 < /AddPassword

However adding password had been failed.

I got
Changing password for Marad100
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
passwd: The password for Marad100 is unchanged.

How can i add password using adduser ?

Thanks
 
Old 10-05-2008, 03:14 PM   #4
izzy8x
LQ Newbie
 
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Lightbulb Hey

Have you tried passwd username ?? It basically prompts you for a new password for the given username without requesting the old one. If the command is written alone will understand you wish to change the username's password pointing in the current shell session.

I should add is a separate command though.
 
  


Reply

Tags
password, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 10:52 PM
how to add user in command shell man_J Linux - Software 4 11-05-2006 08:09 AM
Add user to Webmin through SHELL? mikeshn Linux - General 1 12-05-2003 02:00 PM
Add a user thorugh SHELL? mikeshn Linux - General 4 01-08-2003 10:31 PM
Add User Shell Script DAC Programming 2 10-13-2002 03:12 PM


All times are GMT -5. The time now is 03:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration