1832609 Members
2317 Online
110043 Solutions
New Discussion

Password Changes

 
Nand Kishore Sagi
New Member

Password Changes

Hi All,

I am trying to figure out how I can change my indivdual password on different boxes. The change is only for my user ID. Expect is not available so I cannot use expect. Anything with Perl or Unix shell script. I should be able to give the box name , login id , my old password and new password. This should then go ahead and change the password at the remote box.
Something like this...

changepassword .

Thanks for any help.

Thanks and Regards
Nand Kishore S
8 REPLIES 8
Scott Palmer_1
Trusted Contributor

Re: Password Changes

I am going to assume that you are not a root user. Without the use of any of the above scripting languages, I dont believe that what you want to do is avaliable to non root users. You can log into the box and type passwd which will prompt you to change your password, but there is no remote utility for doing this, that I am aware of. If there is something Like this avaliable, i look forward to hearing about bout it.

Regards
Scott Palmer
Steven E. Protter
Exalted Contributor

Re: Password Changes

Though not secure

# changepassword

ssh root@$1 "/usr/contrib/bin/changepw $2 $3 $4"

on the target box

changepw

passwd $1 << EOF
$3
$3
EOF


note that the target script has the $ variables one less than the original script because a script is calling a script.

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
RAC_1
Honored Contributor

Re: Password Changes

If you enable remsh/rlogin for yourself, this can be done. But I would rather advise the use of expect etc for this.
Enable rlogin/remsh - .rhosts file.

The crude method could as follows.
Beware this echoes the password in clear text.

remsh host "/usr/sam/lbin/usermod.sam -p "`echo 1234abcd|/usr/lbin/makekey`" user_name

Do this for all hosts you want. You password is "1234abcd"

Anil
There is no substitute to HARDWORK
Nand Kishore Sagi
New Member

Re: Password Changes

Hi Scott,

You are right. I am not root. Also I dont have expect installed on the box but I have access to C , Perl and normal shells are always available.

Wanted to know if anything is possible with these langauges.

Thanks for the info.

Thanks and Regards
Nand Kishore S
Senthil Kumar .A_1
Honored Contributor

Re: Password Changes

I have one query to steven and a little reassurance to kisore.

Steven:

I have already tried the here statement solution(i mean <

nandan kisore:

You can try what steven has suggested.Though i'am not 100% sure of the desired result.I will work on system calls using C (pipe,fork,dup) ,basically try to work on standard file descriptions.I doubt i can comeup with a solution,but,I strongly feel its worth a shot.If it works i will get back to you.

regards
Senthil
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
harry d brown jr
Honored Contributor

Re: Password Changes

Talk to your System Administrators about converting your systems to NIS+. That way you change it once for ALL servers that you have access to. If your SA's are good, they may be able to link NIS+ with LDAP (with hooks to AD [active dirt - I mean active directory]) and have an enterprise login scheme.

live free or die
harry
Live Free or Die
Senthil Kumar .A_1
Honored Contributor

Re: Password Changes

hello Nand Kishore,

Eureka,yes thats the word i require to express my excitment.I have used some system calls in my c program & with appropiate manupulation of file descriptor links with the help of pipe(),fork(),dup() and using execl() call to execute the required executable, i was successful in issuing the my custom made command to execute successfully with the passwords given to the it at the command prompt itself.

Now i understand that u do not have root permission.But i assume that u have login/password for the remote machines.In that case you can execute the command i give you with the help of remsh command.Firstly I need some details from you to complete the program.

1)model of your servers.(model command).
2)Type of executable.especially your /usr/bin/passwd file .run "file /usr/bin/passwd".
If you can furnish these details I will compile the program that can be run on your servers.

regards
Senthil
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
hein coulier
Frequent Advisor

Re: Password Changes

Senthil, try "ssh -n", perhaps there wont be connection problems.