1753511 Members
5196 Online
108795 Solutions
New Discussion юеВ

Re: Change password

 
SOLVED
Go to solution
giada
Occasional Contributor

Change password

Hi,
I've the same user on 100 hosts. I must change its password on every host. I'd like to do this with a script. I can use the remsh command. For example:
for host in $(cat host.txt)
do
remsh $host -n ..........

where hosts.txt is a file with the hosts' name
Any idea?
Thanks
Giada
9 REPLIES 9
Peter Godron
Honored Contributor

Re: Change password

Ravi_8
Honored Contributor

Re: Change password

Hi,

your script works, if the rsh has been configured on all the 100 hosts, else the passwd will not change on which rsh has not been configured.

NIS can be used here.
never give up
Rashid Hamid
Regular Advisor

Re: Change password

Hi

If you have 100 hosts, why not you implement NIS. You can centralize user passwd and group in one server.

regards
Rashid
I'm Parit Madirono/Parit Betak Boyz
giada
Occasional Contributor

Re: Change password

The rsh has been configured on all hosts. I couldn't use NIS for organizational and managerial problems.
Thanks
Ravi_8
Honored Contributor

Re: Change password

Hi,

for host in 'cat host.txt'
do
rsh $host
echo " password for the user in host $host"
passwd
done
never give up
Peter Godron
Honored Contributor

Re: Change password

Giada,
please have a look at my previous reply re. updating multiple hosts automatically.

I though you may want to set passwords automatically on each host, rather than from the command line.

Can you please clarify: commandline or multiple change?
Regards
giada
Occasional Contributor

Re: Change password

Peter,
I want to change passwords (the password will be the same for all hosts) from one host automatically on all the other hosts.
Peter Godron
Honored Contributor

Re: Change password

Giada,
thanks for the clarification.
NIS would be the ideal solution, but as you said is not available.
So the process would be:
automatic
copy the password file from the host
modify it with sed
copy it back
or
manual
remsh $host -n vipw
Regards
Bill Hassell
Honored Contributor
Solution

Re: Change password

You can change the password on the remote hosts by using SAM's usermod command which is found in /usr/sam/lbin/usermod.sam

/usr/sam/lbin/usermod.sam -p wehbTH45!i login_name

The -p option allows you to place an encrypted password on the usermod.sam command line. To get the encrypted password, change the password on one of the machines, then copy the encrypted password for use with usermod.sam


Bill Hassell, sysadmin