LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Shell script to change password (https://www.linuxquestions.org/questions/linux-general-1/shell-script-to-change-password-111729/)

kamal_aitin 11-03-2003 01:13 AM

Shell script to change password
 
Hi...
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,
Regards,
kamal.

Tinkster 11-03-2003 01:40 AM

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

Cheers,
Tink

satya_nit 05-22-2006 07:01 AM

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 .

Regards,
Satya

des_a 07-24-2007 04:39 PM

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.

Code:

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.

Junior Hacker 07-24-2007 07:24 PM

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.
Quote:

I have to write a shell script

des_a 07-25-2007 12:09 AM

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:

Code:

echo [passwd] > /tmp/[password file]
passwd --stdin [user] < [file with password]


des_a 07-25-2007 12:09 AM

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.


All times are GMT -5. The time now is 12:34 PM.