- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- replacing text
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
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
07-09-2001 08:44 AM
07-09-2001 08:44 AM
replacing text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 08:57 AM
07-09-2001 08:57 AM
Re: replacing text
`passwd -l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 09:21 AM
07-09-2001 09:21 AM
Re: replacing text
However, if you wish to use sed.
first, you would have to cut -f2 of the passwd file for the user (lets say $var1) then
cat /etc/passwd | sed 's/$var1/\*/' > /etc/passwd.tmp
then
mv /etc/passwd.tmp /etc/passwd
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 09:59 AM
07-09-2001 09:59 AM
Re: replacing text
On the earlier releases of HP-UX passwd -l is not available. I had a script that was very close and spent about two minutes adapting it to your needs. The final copy of the temp file to /etc/passwd is commented out for testing.
Use it like this: clobber user1 user2 ...
It will place an * in the passwd field of user1 user2 ...; there is a value min_uid (100). No change will be made to a user with a UID less than this value. You can set it to another value.
Whenever you are manipulating the passwd file like this, make sure that you make a safe copy of the passwd file and be logged in as root in two sessions. TYou are then able to extricate yourself from a problem as fast as you got yourseld in it.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 10:31 AM
07-09-2001 10:31 AM
Re: replacing text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 10:40 AM
07-09-2001 10:40 AM
Re: replacing text
How about this:
awk -F: 'BEGIN {OFS=":"};{if ($3>=100 && $2!="*") {$2="*";print $0} else {print $0}}' /etc/passwd > /tmp/passwd
This will preserve UID's less than or equal to 100 but will alter those greater than 100.
Regards!
...JRF...