LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-20-2008, 01:43 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Locating Missing Home Directories?


I appear to have a script that had a missing parameter. It would remove all the users files / folders / including their home directory but did not delete them from /etc/skel and /etc/passwd.

So for like 2 months I thought I was deleting users and I was basically just deleting all their data but leaving their UID and GID info on the server.

Can I do a search for all users on the system who have a missing /home/user_dir?
 
Old 05-20-2008, 02:52 PM   #2
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by Carlwill View Post
I appear to have a script that had a missing parameter. It would remove all the users files / folders / including their home directory but did not delete them from /etc/skel and /etc/passwd.

So for like 2 months I thought I was deleting users and I was basically just deleting all their data but leaving their UID and GID info on the server.

Can I do a search for all users on the system who have a missing /home/user_dir?
/etc/skel is a directory that is copied to a new user's home directory when the account is created. It doesn't have any user-specific information in it. So it wouldn't change when you remove a user.

Can't you just edit your /etc/passwd file and remove the old accounts?
 
Old 05-20-2008, 04:32 PM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
There will probably be some leftovers in /tmp and /var/mail as well.
 
Old 05-20-2008, 04:52 PM   #4
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Code:
while read -r usr dir; do [[ -d $dir ]] || echo "$usr dir not present: $dir"; done < <(awk -F":" ' $6 ~ /home/ { print $1,$6 }' /etc/passwd)
This gave me exactly what I was asking for in case anyone needs this in the future...
 
Old 05-20-2008, 04:58 PM   #5
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Glad you could find your solution. And thank you for sharing it with us!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
Locating Gnome 2 directories in C TarrasQ Programming 0 12-20-2004 12:01 PM
how are home directories created waynevnc Debian 3 07-02-2004 08:39 AM
home directories missing after upgrade to 2.4.26 eger Linux - Software 2 05-03-2004 06:11 PM
Missing directories /usr oh my! echoking Slackware 3 09-09-2003 03:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration