• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1674
  • Last Modified:

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

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
TogaMario
Asked:
TogaMario
1 Solution
 
fosiul01Commented:
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
 
TogaMarioAuthor Commented:
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
 
pctechsupportCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now