Change Password In A Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change Password In A Shell Script
# 1  
Old 04-12-2006
Error Change Password In A Shell Script

Hi All,

I have a problem.

I need to write a shell script to change the password. The user may want to change his own password by this script.

He will have to provide the required 3 parameters i.e. old password, new password and retype new password as arguments in command line.

like, ./pass.sh old new new

How do I do it. I am in a fix. Smilie

I am not allowed to use expect etc.

Please help me.

Thanks.
Asimananda
# 2  
Old 04-12-2006
I am unclear as to why the 'passwd' command is not being used. It is executable by "users", and they can only use it to change THEIR password.

Do you want to "capture" their passwords when they change them ? [If so, WHY ?]

Please explain, because the 'passwd' command seems to be what you need (as far as I can tell).
# 3  
Old 04-12-2006
Error

No, it will be a generic script, root user may provide username, password and retype password as arguments to it, it will be an added thing to the script.
It may be useful in changing passwords for many users at a time.
I just wanted to know how do I automatically pass the values to interactive commands like passwd.

Thanks.
Asim
# 4  
Old 04-12-2006
Can anyone please help me doing this?
It would be a great help for me Smilie

Thanks.
Asimananda
# 5  
Old 04-12-2006
I dont have any clue for how to do this either..but may be this is the way forward... may be someone else from the group can help u sorting out this messy script to tell how to do this :-)
#! /bin/ksh
DELAY=1
OLD="oldpasswd"
NEW="nepasswd"
passwd |&
sleep $DELAY
print -p $OLD
sleep $DELAY
print -p $NEW
sleep $DELAY
print -p $NEW
# 6  
Old 04-12-2006
Hi,

Thanks for the reply.

But it's not working. I think some modification is required Smilie

Let's hope we can get a solution for this.

Thanks.
Asimananda
# 7  
Old 06-29-2006
Question changing password by a shell script

I also tried the script but it is not working. If someone have any answeres to it please post me Smilie

Prashant.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Password sent via reset password email is 'weak' and won't allow me to change my password

I was unable to login and so used the "Forgotten Password' process. I was sent a NEWLY-PROVIDED password and a link through which my password could be changed. The NEWLY-PROVIDED password allowed me to login. Following the provided link I attempted to update my password to one of my own... (1 Reply)
Discussion started by: Rich Marton
1 Replies

2. Shell Programming and Scripting

Shell script to change the password

Hi Folks, I am trying to change the password for the user "sysservice" Where my requirement is login to each server and exit from that and ssh to the next server.. I have enabled the password less auth for the user sysservice. for i in `cat /home/sysservice/servers.txt` do ssh... (1 Reply)
Discussion started by: gsiva
1 Replies

3. Shell Programming and Scripting

A script to change password for all other servers

Hey Gurus, I have this requirement to change the password for other servers remotely from one server. So, I installed public keys on all servers and wrote the following script to do the job. Something appears to be wrong with my loop, as it only changes one server and ignores the rest. I'm... (24 Replies)
Discussion started by: Hiroshi
24 Replies

4. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

5. Shell Programming and Scripting

Shell Script to change a user password using script

Hi Experts, I had tried to executes this script to change the user password through script: No lines in buffer #!/bin/ksh cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1 cat /etc/passwd | grep userid >> /tmp/pass.tmp2 PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2` PASS2=`q2w3e4r5` sed... (3 Replies)
Discussion started by: indrajit_renu
3 Replies

6. Shell Programming and Scripting

Password change logic for remote machine using shell and expect

Day before yesterday,I got the success creating a shell script using expect tool and now it is running successfully on the server. Now I want to make some changes in paswwordchanger.sh as you can see it can handle only one user i.e dbaguest and not other user.So I am thinking the logic how I can... (0 Replies)
Discussion started by: manish_1678
0 Replies

7. Shell Programming and Scripting

script to change password for all users

We have a server where we have a number of user ids and we also have the list of old passwords in a CSV file. Now we want to change the password of all the users and assign them a default password.Can we write a shell script to do that. I am planning to read the user name and corresponding... (7 Replies)
Discussion started by: dr46014
7 Replies

8. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

9. Shell Programming and Scripting

force to change password(shell script)

hi How can I force user to change of password by modifying the password expiry and the grace period so that the user has at least 1 week to login and change the password...... (3 Replies)
Discussion started by: tjay83
3 Replies

10. Shell Programming and Scripting

script to change root password

Hi All, I'm looking for a script to change root password for about 200 servers of both Solaris and Linux. I'm not very good at scripting, can anyone share a script if you already have one? :) (3 Replies)
Discussion started by: kvadivel80
3 Replies
Login or Register to Ask a Question