- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- deactivate a users via script
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
03-07-2001 12:56 PM
03-07-2001 12:56 PM
deactivate a users via script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2001 01:19 PM
03-07-2001 01:19 PM
Re: deactivate a users via script
EDITOR=/usr/bin/ed
echo "/^${user}:\ns/:[^:]*:/:*:/\nw\nq" | vipw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2001 01:26 PM
03-07-2001 01:26 PM
Re: deactivate a users via script
awk -v user=name_of_user -F: 'BEGIN{OFS=":"}{if($1==user){$2="*"}{print $0}}' /etc/passwd
to replace the password with a "*" in the password file.
If the system is trusted, use /usr/lbin/modprpw to deactivate the accout.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2001 01:40 PM
03-07-2001 01:40 PM
Re: deactivate a users via script
The vipw command will establish a logical lock on /etc/passwd (other people can't make changes through the standard tools,like /usr/bin/passwd).
setting EDITOR to /usr/bin/ed will call ed to edit /etc/passwd when vipw is run.
The echo command sends the simple ed commands to search for that user and replace the password field with "*".
If this is a trusted system (or uses NIS) then other methods will need to be employed.
I liked vipw because it makes sure that /etc/passwd is not changed while it is being editted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2001 08:49 AM
03-08-2001 08:49 AM
Re: deactivate a users via script
Better yet,
passwd -l $username
where $username is a variable containing the name of the account to be locked (or deactivated). With this, you won't have to worry about locking the /etc/passwd file.
--Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2001 11:17 AM
03-10-2001 11:17 AM
Re: deactivate a users via script
passwd -l ${user_id}
If it is trusted:
/usr/lbin/getprpw -r -m lockout ${user_id}
/usr/lbin/modprpw -k ${user_id}
Regards,
Joseph.