Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-07-08
3
Medium Priority
?
1,579 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 500 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
1

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Users are often faced with high disk consumption without really knowing where the largest amount of data resides. Disk Usage Analyzer (aka Baobab) is is a graphical, menu-driven application to analyse disk usage in any Gnome environment and can e…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

926 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