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

x
?
Solved

Checking for oblete users? And get rid of them.

Posted on 2001-06-18
4
Medium Priority
?
301 Views
Last Modified: 2010-04-21
How do you get a listing of users on the system, find out which ones are retired? Is there a way of seeing the last time the acct was used, so I can retire them? thanks

I am trying to delete users who may not longed on in 3 months. I also trying to clean out all users on the system who are retired.
0
Comment
Question by:petro2
4 Comments
 
LVL 11

Expert Comment

by:griessh
ID: 6203417
I think this problem is a bit more complicated than that. First of all, what is would be too long? There can be accounts that are not being used very frequently or at all, but you still need them to do certain tasks. Then more: what will happen will email accounts, home directories etc?
I think you shoul dget a list of users from your system (usually in the /etc/passwd) and check if they are still active.

======
Werner
0
 
LVL 6

Expert Comment

by:bira
ID: 6206983
Hi

   Use the last command:

   last > lastfile.txt
     ( It can take some minutes )

  check the file lastfile.txt for users that did't logged
  in a certain time you want.

  Once you know that users suspect of being retired,
  check with their departments if they are really gone,
  then delete them.

     Regards
0
 
LVL 5

Accepted Solution

by:
Nisus091197 earned 600 total points
ID: 6233293
All authorized users of the system should have a login in the /etc/passwd file or NIS map.

To find all files owned by a given user, say patc:

find / -user patc -ls

To find out which of these have been modified within the last 3 months:

find / -user patc -mtime -100 -ls

If this returns nothing, remove them:

find / -user patc -mtime -100 -exec rm -f {} \;

Tip:  Edit the /etc/profile so that it echos the date to a file called /usr/local/files/lastlogin.patc when patc logs in.

I have written a cool script which does exactly what you want.  Run it every day/week and it will report to the account manager via email a report on accounts that have not been accessed in three months say.

If you are good with scripting my tip above will see you right.  Otherwise I'll look it up for you.

Please advise.

Regards, Nisus
http://www.omnimodo.com
0
 

Author Comment

by:petro2
ID: 6245327
Thanks I will give it a try. But it will point me in the right direction. jq
0

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

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

886 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