Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-03-2003, 02:13 AM   #1
LQ Newbie
Registered: Aug 2003
Location: Pune,India
Distribution: Redhat 9
Posts: 5

Rep: Reputation: 0
Shell script to change password

I want to write a shell script to change my password and I want that password to be picked up from a file and I'm not supposed to type anything once I run that script and change the password.Is it possible...if yes please send me the solution.

Thanks in advance,
Old 11-03-2003, 02:40 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
man chpasswd
But it's not really a good idea :)

Old 05-22-2006, 08:01 AM   #3
LQ Newbie
Registered: May 2006
Posts: 1

Rep: Reputation: 0
Hi Gurus ,

I am a new member to this group and also a novice user for unix . I have to write a shell script which can change the password of a userid four times. I want that it should read the first 3 passwords from a file . The fourth time the password will be the one which was in the beginning .

Kindly help me .

Old 07-24-2007, 05:39 PM   #4
Registered: Sep 2006
Posts: 385

Rep: Reputation: 18
Looks like I'll need a script to do this same thing, as well, I'm seeing. I found one thing that doesn't work.

passwd < [file name]
I'm trying to do this for another similar reason as you guys. I'll check out that man page too. It might work for me.
Old 07-24-2007, 08:24 PM   #5
Junior Hacker
Senior Member
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Sounds like this exercise may be part of the curriculum of some similar course the three of you are taking when considering the quote below.
I have to write a shell script
Old 07-25-2007, 01:09 AM   #6
Registered: Sep 2006
Posts: 385

Rep: Reputation: 18
And now, I've found what does work for me, in my limited case of what I needed. If this solution works for you too, then here it is:

echo [passwd] > /tmp/[password file]
passwd --stdin [user] < [file with password]
Old 07-25-2007, 01:09 AM   #7
Registered: Sep 2006
Posts: 385

Rep: Reputation: 18
When I found this, by the way, it was after looking up chpassword, and I couldn't make it work for me, for some reason.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change batch script to shell script alan.belizario Programming 5 03-31-2005 01:41 AM
Change batch script to shell script alan.belizario Linux - Software 1 03-30-2005 02:49 AM
Shell Script For Password cpope67 Programming 4 01-10-2005 03:16 AM
Password Shell Script Solaris 9 cpope67 Solaris / OpenSolaris 1 12-30-2004 04:15 PM
Restricted shell to change the password mussons Linux - Security 12 07-24-2003 11:05 PM

All times are GMT -5. The time now is 01:55 PM.

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