LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2003, 08:31 PM   #1
petertm
LQ Newbie
 
Registered: Feb 2003
Distribution: Red Hat Linux
Posts: 2

Rep: Reputation: 0
Batch change passwords


I need to change 1000+ individuals passwords back to a default password. As much as I would love to give this to my backup to do by hand, I am just not that cruel. I need an easy way to do this. In Solaris I can do this by using "pass username passwd", but I can't figure out how to do the same thing in RH Linux 7.2. I have done this in the past but I can't remember how I did it.

Any assistance would be GREATLY appreciated.
 
Old 02-05-2003, 10:03 PM   #2
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
`man passwd'

generally it's

`passwd <username>'
<old password (if you're not root)>
<newpassword>
<newpassword again>
 
Old 02-05-2003, 11:43 PM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Re: Batch change passwords

Quote:
Originally posted by petertm
I need to change 1000+ individuals passwords back to a default password.

[snip]

I need an easy way to do this.

Not sure how easy you'll think this is but this sort of problem is exactly the sort of thing that the `expect' scripting language was designed for (automating the use of interactive programs). In fact, many of Don Libes's early examples of using expect involved tasks where one was dinking around with passwords. I think an relatively short expect script invoked repeatedly within a simple shell script that reads /etc/passwd for the user account names would be the simplest. And you'd need to run this as root since your changing other user's passwords. Finally, make sure you only do this for regular users; parse /etc/passwd for, say, members of the `users' group, group numbers greater than N, or something like that. You don't want to go changing root's password to ``ChangeMe'' and some accounts should never have a valid password.

Good luck,

Rick
 
Old 02-06-2003, 10:21 AM   #4
petertm
LQ Newbie
 
Registered: Feb 2003
Distribution: Red Hat Linux
Posts: 2

Original Poster
Rep: Reputation: 0
Smile

OK I figured out how I did it and it is extremely easy.

chpasswd with a file that contains the username:password pairs.

it is actually pretty quick.

Thanks for all who replied.

Theresa
 
  


Reply



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
How to change root and username passwords? wardialer Mandriva 8 10-04-2004 07:32 AM
Cannot change NIS passwords in Squirrelmail zapperabhi Linux - Software 1 03-22-2004 11:08 PM
change passwords krb5 acb67 Linux - Security 0 07-29-2003 10:21 AM
problem with users trying to change passwords erikm103 Linux - General 1 03-10-2003 05:10 PM
Why do user's passwords change? J_Szucs *BSD 7 07-09-2002 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:52 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
Open Source Consulting | Domain Registration