- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to change passwd with in the scrip with out as...
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
Discussions
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
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
11-23-2007 02:19 AM
11-23-2007 02:19 AM
I need to change the password for the user with in the scrip(with in the scrip i have given the password)
While running that scrip it should not ask for password
That scrip is run by root
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2007 03:07 AM
11-23-2007 03:07 AM
Re: How to change passwd with in the scrip with out asking in the terminal
please, can you post your original script used to given teh passwords?
This may help in fix your problem.
Rgds,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2007 03:15 AM
11-23-2007 03:15 AM
Re: How to change passwd with in the scrip with out asking in the terminal
here i am giving you the snap shot
New_passwd=xzy #is the new password
passwd user
with in the scrip If we use above command it will ask for passwd in the terminal when we run that script
New_passwd=xzy #is the new password
passwd user < New_passwd
what I need is it should not ask for password when I run it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2007 01:09 PM
11-23-2007 01:09 PM
Re: How to change passwd with in the scrip with out asking in the terminal
Check this:
http://www.circlingcycle.com.au/Unix-sources/add-batch-Unix-accounts.pl.txt
You will easily see commands you can use to change user's password in HPUX, Solaris, AIX, Linux, and Tru64 in a script :)
Cheers,
VK2COT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2007 06:56 PM
11-23-2007 06:56 PM
Re: How to change passwd with in the scrip with out asking in the terminal
It is more complex
Can you given me a small example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2007 06:58 PM
11-23-2007 06:58 PM
Re: How to change passwd with in the scrip with out asking in the terminal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2007 09:44 AM
11-25-2007 09:44 AM
Solution/usr/sam/lbin/usermod.sam -p passwordhash
Your problem is how to find out the
passwordhash. It is the encrypted password
string (the one you see in /etc/passwd or
/etc/shadow...)
Normally, you would have to use some kind
of random password generators. That is
where Perl and Expect scripts, and other tools come handy.
If you already have a good passwordhash
string, then you are OK.
The alternative is to use GNU useradd with
flag "-p":
You get an already-encrypted passwd, and use
the -p
the other options can automate this process:
useradd -d /home/user1 -g users -m -k -p passwordhash -s /bin/ksh
So, in the end, simple lines for your script:
#!/bin/sh
PATH=/usr/sbin:/sbin:/bin:/usr/sam/lbin; export PATH
MYSALT="somestring"
MYPASS="whateverpassword"
MYENCPASS=`perl -e 'print crypt("mypassword", "salt"),"\n"'`
usermod.sam -p $MYENCPASS username
exit 0
It is a trivial exercise to add more features
in the script (like error checking, or adding support for command-line arguiments).
Please do not forget to assign points if you find any advice in ITRC forums useful.
Cheers,
VK2COT