#45 Suspending a User Account

Whether a user is being escorted off the premises by security for industrial espionage, a student is taking the summer off, or a contractor is going on hiatus, there are many times when it's useful to disable an account without actually deleting it from the system.

This can be done simply by changing the user's password to a new value that he or she isn't told, but if the user is logged in at the time, it's also important to log him or her out and shut off access to that home directory from other accounts on the system. When an account is suspended, odds are very good that the user needs to be off the system now, not when he or she feels like it.

Much of this script revolves around ascertaining whether the ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.