- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: changing password for users
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2007 07:29 PM
07-18-2007 07:29 PM
changing password for users
Or is there any script available where i can give the username and new password as parameters and then the password gets set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2007 09:07 PM
07-18-2007 09:07 PM
Re: changing password for users
Note: this can be used to change the password of a userid to a standard new password, replace the string "Jusilasdfjjl" with the standard new password.
I am sure you know how to get the new password string.
Also you can have the usserid replaced by an argument.
#!/bin/ksh
cat passwd | grep -v userid >> pass.tmp1
cat passwd | grep userid >> pass.tmp2
PASS1=`cat pass.tmp2 | cut -d ":" -f2`
PASS2=`Jusilasdfjjl`
sed 's/$PASS1/$PASS2/g' pass.tmp2 > TMPFILE && mv TMPFILE pass.tmp2
cat pass.tmp2 >> pass.tmp1
mv pass.tmp1 passwd
Best of luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2007 11:13 PM
07-18-2007 11:13 PM
Re: changing password for users
You may try by installing expect on your system . Once you have expect installed on system you can user
#autopasswd username new passwd
Regards,
Javed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 01:10 AM
07-19-2007 01:10 AM
Re: changing password for users
The psaswd command, like telnet, does not accept redirected stdin. As mentioned, expect is a program that's designed to circumvent this issue by using psuedo ttys.
Unfortunately, expect's programming syntax leaves ALOT to be desired.
On the bright side, though, perl has an expect module so you have all the power of expect with the sytnaxt of perl. They make an absolutely outstanding combination.
I don't have a current perl script to change user's passwords. I do have one to change root's password that relies on ssh access to root using public key authentication (the only way to allow direct root access).
I can post it if you're familiar with perl; otherwise, it wouldn't be worth your time.
Let me know.
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2007 04:40 AM
07-31-2007 04:40 AM
Re: changing password for users
Thanks for your inputs. I have few more questions:
Nagashankarp: After foloowing the procedure that you suggested, the passwords are not getting into effect...Should I do something more?
Javed Khan: Do you know if expect is part of HP-UX MC-OE bundle? Also, is there a installer available from HP?
Doug O'Leary: I wanted to know how I can make use of the "expect" in PERL. Any thoughts? Also, you can send me the script to reset root password. That would be very handy for me.
Thanks,
AMicSys
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 01:16 AM
08-01-2007 01:16 AM
Re: changing password for users
As for the first suggestion, I'd be very careful about automatically replacing the password file. One misstep and your password file is gone meaning no access to the system. I don't see anything wrong with the logic, but it's generally a risky proposition.
Expect does not come with HPUX; however, you can download a precompiled binary in depot format from http://hpux.cs.utah.edu/hppd/hpux/Tcl/expect-5.43/
The script, mypwd, is attached. As I said previously, this iteration assumes an ability to directly login to root via public key authentication (the only way to allow direct root access). It can certainly be expanded to either ssh in as a normal user, then sudo su - password, or any number of other possibilities.
The expect module doesn't come with the perl installation either. It has to be installed. There's a fairly significant number of prerequisite modules that must be installed as well some of which have to be compiled. I've had mixed results getting the expect module working on HP systems (w/GNU compiler installed) which is one of the reasons most of my expect work is done on Linux boxes.
perl -MCPAN -e shell
cpan> install Expect
should do the trick for you. The CPAN module will install and compile all the modules needed to install Expect.
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 09:39 PM
08-01-2007 09:39 PM
Re: changing password for users
Amicsys : If your using NIS,i think you should do a ypmake
Also make user the PASS2 variable has the right string, this you can get by setting a temp user to the required password and using the password string from it.