Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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,510 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Creating a Samba server for a small office. Ubuntu Linux and Samba can breathe new life into a retired PC and save an office money on new hardware/software. Our example server will have two hard disks, one exclusively for storing shared data. …
Are you sitting there reading this and wondering how to get started with Linux? It almost seems like picking the right Linux distribution is about like picking the right college or buying a new car if you read some of the article out there. Relax… l…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

721 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