LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 08-28-2005, 08:42 AM   #1
naren_0101bits
Member
 
Registered: Jul 2004
Location: Guntur
Posts: 44

Rep: Reputation: 15
Question Need shell script to set passwords for already created users


hello everybody !

Iam just a Linux newbie. And iam just learning to write shell scrips.
Iam trying to write a shell script which sets passwords for already created users without any sort of furthur interaction.

Suppose, for example, i created 50 users named user1, user2, .... user50.
And i want to set the same usernames as passwords to them by using a shell script.

Iam unable to do it.
So, please help me in writing this shell script. If its simple enough, then please send the script in reply.

Thanks to all in advance.

warmth...
NARENDRA SAIRAM IMMADI
 
Old 08-28-2005, 11:31 AM   #2
dub.wav
Member
 
Registered: Aug 2003
Location: Norway
Distribution: FC4
Posts: 83

Rep: Reputation: 20
A list of users can be found in /etc/passwd . Simply grep for whatever prefix you have on the users, and use cut to extract the usernames.
Then, run passwd on each user.
If you need more details, check out: http://www.tldp.org/LDP/abs/html/
 
Old 08-28-2005, 03:02 PM   #3
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Why not use useradd's -p flag to set the password when you create the accounts?
 
  


Reply


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
Adding new users via Shell script coolfrog Linux - General 10 12-05-2010 11:47 AM
can I set these flags using a shell script nirav.jani Linux - Security 1 01-12-2005 07:01 PM
How do you set a shell script var with a literal '*'? BrianK Programming 3 06-22-2004 03:11 PM
Cant set passwords for new users ribbones Linux - Newbie 2 09-03-2003 11:52 AM
Linux Users created via Script ??? HOW ?? Lutzer Linux - Networking 1 07-31-2002 05:03 AM


All times are GMT -5. The time now is 10:44 AM.

Main Menu
Advertisement
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