Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-05-2003, 09:31 PM   #1
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, 11:03 PM   #2
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 again>
Old 02-06-2003, 12:43 AM   #3
Senior Member
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: CentOS, MacOS, [Open]SuSE, Raspian, Red Hat, Slackware, Solaris, Tru64
Posts: 1,242

Rep: Reputation: 80
Re: Batch change passwords

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


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,

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

Original Poster
Rep: Reputation: 0

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.



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

All times are GMT -5. The time now is 04:46 AM.

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