- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Non-interactive mode Pwd change of a user
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
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
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
тАО10-10-2023 01:50 AM - last edited on тАО10-10-2023 05:50 AM by support_s
тАО10-10-2023 01:50 AM - last edited on тАО10-10-2023 05:50 AM by support_s
Non-interactive mode Pwd change of a user
Hello Experts,
I am very new to HPUX system and looking for a command to set the user constant password (non-interactive mode , i mean terminal should not prompt for to type the password to newPassword and confirm Password).
When i was using the command in terminal to set the pwd of a user "echo "Welcome1234" | passwd "John" though its working but command prompting for pwd and new pwd ; also i tried using below command to set the non-interactive mode password,
/usr/lbin/modprpw -v -l john -s Welcome1234. but the Output of the terminal is "modprpw: error in argument; check before and after John"
Appreciate any help in advance !
- Tags:
- Operating System
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2023 04:38 AM
тАО10-10-2023 04:38 AM
Re: Non-interactive mode Pwd change of a user
> [...] looking for a command to set the user constant password
> (non-interactive mode [...]
I'd expect a Forum search for terms like, say:
change password script
to find a suggestion or two in a couple of previous threads on this
topic.
> /usr/lbin/modprpw -v -l john -s Welcome1234. but the Output of the
< terminal is "modprpw: error in argument; check before and after John"
I'd avoid modprpw, and I don't have an HP-UX system running at the
moment, so I know nothing, but who says that modprpw has a "-s" option?
man modprpw
My quick Web search found, for example:
https://nixdoc.net/man-pages/HP-UX/man1m/modprpw.1m.html
where I see no such option. (Note that "-s" is "after John" in your
failing command.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2023 05:05 AM
тАО10-10-2023 05:05 AM
Re: Non-interactive mode Pwd change of a user
You may want to try to use a "here" script to accomplish it.
As a non-root user you will be asked to type in the old password, and 2-times the new one:
E.g. (can┬┤t test as i don┬┤t have access to HPUX systems anymore):
#!/sbin/sh
username="John" pw="old_password" new_pw="Welcome1234" passwd ${username} << EOD ${pw} ${new_pw} ${new_pw} EOD
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2023 11:23 AM
тАО10-10-2023 11:23 AM
Re: Non-interactive mode Pwd change of a user
> You may want to try to use a "here" script [...]
That's a "here document" (which is used in a script).
https://en.wikipedia.org/wiki/Here_document
The problem with that is when the program ("passwd" in this case)
reads from the user's terminal device rather than the process stdin.
Like you, I can't test it at the moment, but I'd guess that that's why
practically all the suggestions for similar queries over many years have
involved using "expect".
> As a non-root user [...]
If he's specifying a user name, then he'd better not be a non-root
user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2023 09:19 PM
тАО10-10-2023 09:19 PM
Re: Non-interactive mode Pwd change of a user
> [...] echo "Welcome1234" | passwd "John" though its working but
> command prompting for pwd and new pwd ; [...]
I doubt that that's working. The reason that "passwd" might be
prompting with "New password: " and "Re-enter new password:" is that
it's ignoring your piped input. (I claim.) If you put in some
_different_ string at the prompts, then I suspect that you'll find that
the user's password has been changed to whatever you put in at the
prompts, _not_ what's in your "echo" command. That's what I saw on my
system:
dyi# uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license
If you decide to try a method which I'd expect to work:
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.45/
https://www.nist.gov/services-resources/software/expect
https://sourceforge.net/projects/expect/files/
Sadly, "expect" does seem to have a bunch of prerequisites, so using
"depothelper" from the HP-UX Porting and Archive Centre might be the
best way for someone who is "very new to HPUX system" to get it. Should
be educational.