HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to change password remotely?
Operating System - HP-UX
1833589
Members
3751
Online
110061
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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-2001 11:09 PM
10-10-2001 11:09 PM
Hi,
I need to add an account to about 200 servers. Ofcourse i am doing this with a script.
But how do you set the password for all these accounts?
It is not possible with useradd. The command passwd can only be used locally.
Is there any way except for editing the passwd file on these servers to change the password?
Boudewijn
I need to add an account to about 200 servers. Ofcourse i am doing this with a script.
But how do you set the password for all these accounts?
It is not possible with useradd. The command passwd can only be used locally.
Is there any way except for editing the passwd file on these servers to change the password?
Boudewijn
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 11:28 PM
10-10-2001 11:28 PM
Solution
Hi Boudewijn,
I use the following script to change the root password. For safety/simplicity, I rcp the script across to all servers. Obviously, you should change "root" and uid=0/gid=3 to your new username/uid/gid (assuming it's the same on all servers).
Change the password on one server to get the encrypted string, then run this script everywhere using the encrypted password as the argument. You can do this with a simple loop:
for host in list_of_hosts ; do
change_passwd passwd-string
done
The script ensures that the string doesn't contain a "/", otherwise sed will fail and you'll be left with no passwd file!!
I would test/run it on a server where you already have a root login, just in case...That way you'll be confident it all works as you want.
===========================================
#!/bin/ksh
# Change root passwd
if [ $# -ne 1 ] ; then
echo Syntax: change_passwd {encrypted passwd string}
exit 1
fi
echo $1 | grep -q /
if [ $? -eq 0 ] ; then
echo The password string must not contain a slash
exit 1
fi
cp /etc/passwd /etc/passwd.old
if [ $? -eq 0 ] ; then
sed -e "s/^root:.*:0:.:/root:$1:0:3:/" /etc/passwd.old > /etc/passwd
chmod 444 /etc/passwd
chown root:sys /etc/passwd
else
echo copy failed
fi
===========================================
Rgds, Robin.
I use the following script to change the root password. For safety/simplicity, I rcp the script across to all servers. Obviously, you should change "root" and uid=0/gid=3 to your new username/uid/gid (assuming it's the same on all servers).
Change the password on one server to get the encrypted string, then run this script everywhere using the encrypted password as the argument. You can do this with a simple loop:
for host in list_of_hosts ; do
change_passwd passwd-string
done
The script ensures that the string doesn't contain a "/", otherwise sed will fail and you'll be left with no passwd file!!
I would test/run it on a server where you already have a root login, just in case...That way you'll be confident it all works as you want.
===========================================
#!/bin/ksh
# Change root passwd
if [ $# -ne 1 ] ; then
echo Syntax: change_passwd {encrypted passwd string}
exit 1
fi
echo $1 | grep -q /
if [ $? -eq 0 ] ; then
echo The password string must not contain a slash
exit 1
fi
cp /etc/passwd /etc/passwd.old
if [ $? -eq 0 ] ; then
sed -e "s/^root:.*:0:.:/root:$1:0:3:/" /etc/passwd.old > /etc/passwd
chmod 444 /etc/passwd
chown root:sys /etc/passwd
else
echo copy failed
fi
===========================================
Rgds, Robin.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP