Operating System - HP-UX
1824976 Members
3390 Online
109678 Solutions
New Discussion юеВ

script to change password on remote server

 
Sunny Jaisinghani
Trusted Contributor

script to change password on remote server

hello all,

i want to change the passwords of normal users on more than 100 HP-UX servers. for this i need a script which will login to the servers one by one and change passwords.

i tried using rexec

rexec -l -n /appl/tsu/bin/sudo passwd

i am able to login to the remote server but istead of prompting me to enter the choice "p" to select my own password it comes out of the remote shell and

displays illegal choice.

can anyone tell me where i am going wrong. am i using the right command or i need to use rexec() call

Thanks in advance.
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: script to change password on remote server

Shalom,

What's wrong? You are trying to do something the OS passwd command is designed to prevent.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Yogeeraj_1
Honored Contributor

Re: script to change password on remote server

hi,

Should use something like:

#!/bin/sh
for host in node1, node2, Node3, Node4,Node5
do
function logon
{
trap INT
echo root
sleep 1
echo $PASSIN
sleep 2
echo ls
stty echo

echo exit
}

logon | telnet $1

done

Also have a look at the following threads:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1039966

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1094727

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1050251

hope these help!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Sunny Jaisinghani
Trusted Contributor

Re: script to change password on remote server

Hi Steven,

the user with -l option and the user who's password i am trying to change are same. so what am i doing wrong in this.

it is similar to rlogin to remote host with the same user account and changing password.

i just want to save few key strokes.

Yogeeraj,

can u explain the script you gave suggested coz i am not an expert in scripting. i am not confident enough to test the script on a production server without understanding it.

Thanks