Solved

How do I disable a Red Hat user account that has been inactive for 'x' days?

Posted on 2009-07-08
3
1,239 Views
Last Modified: 2016-06-15
How do I disable a Red Hat (Enterprise Linux 5.3) user account that has been inactive for 'x' days?

I want user accounts that haven't logged into the system after a certain amount of time to be locked.
0
Comment
Question by:TogaMario
3 Comments
 
LVL 29

Accepted Solution

by:
fosiul01 earned 125 total points
ID: 24804465
lastlog will show you the last activity of user

you can use

lastlog -u username

but if you want to make it automatic then you will have to use a script to do this
0
 

Author Closing Comment

by:TogaMario
ID: 31601119
That was exactly what I needed to know, thank you. I've setup a cron job that runs every day at midnight - it marches through the /etc/passwd file, pulls out the usernames, checks them against activity in lastlog and uses the "passwd" command appopriately to disable wayward accounts.
0
 

Expert Comment

by:pctechsupport
ID: 41655376
Late, I know, but you can use pam_lastlog to do this without having to use scripts and cron.
 To lock out an account after 10 days of inactivity, add, as root, the following line to the auth section of the /etc/pam.d/login file:

auth  required  pam_lastlog.so inactive=10
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now