1748001 Members
4519 Online
108757 Solutions
New Discussion юеВ

Script for password

 
SOLVED
Go to solution
Venkat_33
Frequent Advisor

Script for password

I have 5 servers which are ll i want to change the password through script.

Pls help me how to do
8 REPLIES 8
Andrey Tumanov
Frequent Advisor

Re: Script for password

A script to change a password on a server, or a script to change the password on 5 servers at once?

Do you have trusted system?

Andrey
RAC_1
Honored Contributor

Re: Script for password

There are many ways to do it.

1. some expect scripting.
2. directly pasting the encrypted password in password feild - not good though
3. If you have centralised password management.
3. You can use following command to do that.

/usr/sam/lbin/usermod.sam -p "$(echo "1234abcdxy" | /usr/lbin/makekey)" "user_name"

The password will be set as 1234abcd. The password has to be of 8 chars and xy is salt chars used.
There is no substitute to HARDWORK
Venkat_33
Frequent Advisor

Re: Script for password

a script to change the password on 5 servers at once?

i wont like to use SAM because we had 5 servers ( inlcuding aix and linux box)
Peter Nikitka
Honored Contributor

Re: Script for password

Hi,

creating a NIS domain for five servers seems not unreasonable to me.
I guess searching for 'NIS setup' in this forum will get some matches ...

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Venkat_33
Frequent Advisor

Re: Script for password

i dont have NIS i want a simple script to change password for 5 system which have sameuser account.
Please help
Sandman!
Honored Contributor

Re: Script for password

In that case expect would be the tool of choice for automating the password changes across all the servers that have the same user account(s).

Expect is freeware and it'll run on Unix/Linux systems and can be downloaded from here...http://expect.nist.gov/

~cheers
Venkat_33
Frequent Advisor

Re: Script for password

i need script bcause i am new in linux so pls help
Frank de Vries
Respected Contributor
Solution

Re: Script for password

Hi Mr Venkat

Doesn't seem to complicated to me.

If you just keep it simple for a moment,
disregard security and forget it is a productive system one scenario would be
something like this:

#!/sbin/bash
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

Naturally there are many other
ways to achieve the same result.

You could first compare if the entry already
exists in the passwd file and script that and
schedule it in background.
I presume you have enough scripting knowledge to script the interface (if
you need one)

What security is concerned you could
tie it down a bit, by creating a dedicated account on each Node for this household task only. With only access to the passwd cmd.
(But I would protect and except root from
this altogether, thus only the superuser can
change the superuser passwd). But this account could change user accounts only.
That way you can monitor the accounts and
determine permissions and keep security
pretty good.

Anyway, just some idea's, sure it can be
improved upon ...
Look before you leap