Solved

List orphans home directories on AIX.

Posted on 2010-11-18
3
654 Views
Last Modified: 2013-11-17
Hi
I want to list the orphans home directories on our AIX's servers. You know when you delete a user but no its home, this directory remains in /home. All these folders are the ones I want to delete. I'd like to compare the home's directories with the stanza home= from lsuser output.

Thanks.
0
Comment
Question by:sminfo
  • 2
3 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34163002
Hello again,

A fast way:

for HOME in $(lsuser -a home ALL | cut -f2 -d"="); do [ ! -d $HOME ] && echo "Directory $HOME does not exist"; done

If you want to get the username listed as well please let me know!

wmp

0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 34163029
The same check ex negativo:

for HOME in $(ls -d /home/*); do [ $(grep -c $HOME /etc/passwd) -eq 0 ] && echo "User of $HOME does not exist"; done
0
 

Author Closing Comment

by:sminfo
ID: 34163063
The second one. :-)

Thanks!!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

758 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

22 Experts available now in Live!

Get 1:1 Help Now