HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script for changing root passwd
Operating System - HP-UX
1830354
Members
2109
Online
110001
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
11-23-2002 09:02 PM
11-23-2002 09:02 PM
HI,
I would like to write a script to change the root passwd in /etc/passwd on every machine on a monthly basis i.e the 1st day of the month.
But I'm really unsure how I could just access the 1st line in the /etc/passwd file which contains the entry for root and its encrypted passwd. I'd then like to modify the second field for root's entry (the encrypted passwd) to a new value.
The new passwd value is to be read from a file.
Could someone show me how the script should be written in AWK or any other scripting languages? I need to also check that for every begining of the month, the passwd should be modified.
Could someone kindly help me out? I'm still a newbie to scripting.
Thanks
I would like to write a script to change the root passwd in /etc/passwd on every machine on a monthly basis i.e the 1st day of the month.
But I'm really unsure how I could just access the 1st line in the /etc/passwd file which contains the entry for root and its encrypted passwd. I'd then like to modify the second field for root's entry (the encrypted passwd) to a new value.
The new passwd value is to be read from a file.
Could someone show me how the script should be written in AWK or any other scripting languages? I need to also check that for every begining of the month, the passwd should be modified.
Could someone kindly help me out? I'm still a newbie to scripting.
Thanks
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2002 12:16 PM
11-24-2002 12:16 PM
Solutiondo something like this:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xbdb6cf38d6bdd5118ff10090279cd0f9,00.html
and please read this
http://66.216.15.50/ITRCForumsEtiquette
live free or die
harry
Live Free or Die
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2002 12:32 AM
11-25-2002 12:32 AM
Re: Script for changing root passwd
Hi,
This script should d it :
/tmp/NEW contains the new password. I use vipw to add security check after modification. Just in case ...
Regards.
#!/usr/bin/sh
[ $(date +'%d') != 1 ] &&
{
echo not first day of month ...
exit 1
}
NEWPASS=$(cat /tmp/NEW)
vipw <<+++
/^root:
f:lct:$NEWPASSx!
+++
This script should d it :
/tmp/NEW contains the new password. I use vipw to add security check after modification. Just in case ...
Regards.
#!/usr/bin/sh
[ $(date +'%d') != 1 ] &&
{
echo not first day of month ...
exit 1
}
NEWPASS=$(cat /tmp/NEW)
vipw <<+++
/^root:
f:lct:$NEWPASSx!
+++
It works for me (© Bill McNAMARA ...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2002 03:48 AM
11-25-2002 03:48 AM
Re: Script for changing root passwd
hi
Cut and Paste problem
f:lct:$NEWPASSx!
should have an ESC (use CTRL-V then ESC)inserted before last x :
f:lct:$NEWPASS^[x!
Regards.
Cut and Paste problem
f:lct:$NEWPASSx!
should have an ESC (use CTRL-V then ESC)inserted before last x :
f:lct:$NEWPASS^[x!
Regards.
It works for me (© Bill McNAMARA ...)
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