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

x
?
Solved

List orphans home directories on AIX.

Posted on 2010-11-18
3
Medium Priority
?
668 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
[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
  • 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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 how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

661 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