- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Changing passwd by script
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
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
тАО09-24-2009 09:27 PM
тАО09-24-2009 09:27 PM
How can I change password for any non-root users by using a script?
Basically, I want to know how can we INPUT password twice while changing password in a script.
Changing password for abcd
New password: <<===
Re-enter new password: <<===
Thanks.
Solved! Go to Solution.
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 10:55 PM
тАО09-24-2009 10:55 PM
Re: Changing passwd by script
keywords like, say:
change password script
might find a suggestion or two in a couple of
previous threads on this topic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 11:34 PM
тАО09-24-2009 11:34 PM
Re: Changing passwd by script
I have already searched and came mostly across "expect". But could not get a clear picture of how to use it. Is that the only tool meant for changing password by script.
Scenario:
If I have 5 users say a,b,c,d,e; how can I change their passwords to a default one with the help of script (please ignore security concerns).
This is basically what I am looking for.
Advices will be appreciated..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2009 12:20 AM
тАО09-25-2009 12:20 AM
Re: Changing passwd by script
There are number of scripts around.
At one stage, I wrote per script to
add bulk Unix accounts (with passwords)
on Linux, HP-UX, Solaris, Tru64, and AIX.
Check it and you will get an idea how to do
what you want easily:
http://www.circlingcycle.com.au/Unix-sources/add-batch-Unix-accounts.pl.txt
Cheers,
VK2COT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2009 03:09 AM
тАО09-25-2009 03:09 AM
Solution> I have already searched and came mostly across "expect".
> Is that the only tool meant for changing password by script.
To automate dialogs with text-based programs anything that can do a "popen" (or similar workaraound) will be fine.
"expect" is just one of the most popular tools to create such interfaces.
Attached is a script for "expect" that does what you need.
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2009 04:11 AM
тАО09-25-2009 04:11 AM
Re: Changing passwd by script
You could use the Perl script I provided in this thread to generate an encrypted password for use with 'usermod':
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1252591
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2009 04:47 AM
тАО09-25-2009 04:47 AM
Re: Changing passwd by script
I can not post the script but I use the following two commands in it to set the password to a default one.
pw_encr=`echo "pw_def" | /usr//lbin/makekey`
/usr/sam/lbin/usermod.sam -p pw_encr username
The username can be a shell variable that is read from a file or given on the command line as $1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2009 08:00 PM
тАО09-25-2009 08:00 PM
Re: Changing passwd by script
I will try your suggestions once I get back to work and will update you.