I really need urgent help with deleting ghost (owner is only numbers) accounts on our OS X server in users home directory.
I get this ghost accounts after deleting a user from Workgroup Manager.
I have done a script that I can see this ghost accounts with:
The thing here is that I want to delete the directory to this owner, here is some examples for users on the server.
I want to delete all directories with numbers (only 4 digits) as owner like:
These ghosts user users as you call them seem to be past defined users removed from the passwd file but where you chose NOt to remove their files... You should be able to extract all defined users and compare with the home directory (what is not in passwd is old and so you see the affected UID given at the time)
These ghosts user users as you call them seem to be past defined users removed from the passwd file but where you chose NOt to remove their files... You should be able to extract all defined users and compare with the home directory (what is not in passwd is old and so you see the affected UID given at the time)
Hi!
I'm not exactly sure how you mean now. I know, it's strange that when I delete an account in workgroup manager, the home directory for that user doesn't removes. So that is why I need a script to delete this numbered owners on the server.
I don't think I can do this on an easier way than to delete the user home directories with some script... But I need help do do this.
EDIT
This seems to be more difficult than I first thought. But I have some idea how to do this.
With this script ls -la | Awk '{print $3" "$9}' | grep '[0-9][0-9][0-9][0-9]'
I get this result:
5074 AbdMow1121
5248 AdaChr0814
5196 AdrLuk0908
1355 AgnBr02
5276 AgnHel0616
AgnMat0422 AgnMat0422
5274 AhmHas0101
AidHod0126 AidHod0126
5288 AidJac0313
1104 AleBe11
5242 AleBor1201
5265 AleFor0217
5019 AleHal0502
I'm very near my goal now, the only thing I want to do know is to filter the names from the first column like:
AgnMat0422
AidHod0126
AleNou1112
And so on...
Do someone know any possibility to only focus on the first column with grep so grep doesn't notice about the second column so I only need to type:
ls -la | Awk '{print $3" "$9}' | grep '[0-9][0-9][0-9][0-9]' But are only interested to grep $3 not the $9 column...
---------- Post updated at 09:11 AM ---------- Previous update was at 07:00 AM ----------
I solved the problem myself:
I was very near the solution but forget the ^ in the beginning of the grep syntax. Here is the code to delete this user directories:
Last edited by vbe; 08-18-2011 at 10:01 AM..
Reason: use code tags please for code and data
I was a bit reticent to answer for the only Mac OSX I have is my power book I bought second hand last year and I was very confused ( and still am..) not finding the files where expected (like all other unixes...). Glad you solved by yourself and thaks for letting us know
About the accounts I dont know linux enough to tell but lets say on HPUX when you remove a user you have the choice to remover all files belonging to user and home directory, leave the files whre they are ( your case) or give them to another user. Files created by such users could be elsewhere also...( but again I have no knowledge on Mac...). So if you had a list of uid that have files that have to be removed you would a root look for them and remove them, so looking for them: say uid 2020
I let you correct for removing...
This would be alot cleaner->
Try creating some files with fictitious four digit UID's then run this command. When you familiarize yourself with awk's system call then apply the appropriate command.
Hello,
I have a user Bob on a RHEL 7 server1. Where his script area is "/home/Bob/scripts/" and he is the owner for this directory.
On the server1, there is a NFS mount from another server2, with path as "/global/work/" and Bob is the owner for this directory too in server2. (Same UID and GID... (5 Replies)
Hi.
My example:
I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that
chown -R log_adm /log/*
chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Would the owner as listed , be the one who made the directory in the first place. when any one could use chown in a script.
I do not know where this directory came form or who made it. And am attempting to just find out more info on it.
what could i use to find its origins and its why does it... (3 Replies)
The a chown was done and instead of using ./ a / was used and root ownership files got changed.
I need to change the ownership of the files/directory back - backups are not working and I am concerned a reboot will not be successful.
Can anyone provide the ownership of these files/directories... (6 Replies)
Hello, i would like to find huge files and group them by owners.
To find big files i use this command:
ls -lR | sort -bnr +4 | head -n 75
which give me 75 biggest files, then i need to see in which subdirectory is every file.
second thing i dont know is how to group those files by owner, could... (6 Replies)
hai,
I am new to Unix, I have a requirement to display owner name , directory or sub directory name, who's owner name is not equal to "oasitqtc".
(here "oasitqtc" is the owner of the directory or sub directory.)
i have a command (below) which will display all folders and sub folders, but i... (6 Replies)
hi all,
i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner.
for one file it is " stat -c %U filename " but i need to search for each and every file and record it.
thanks in advance (14 Replies)
I'm trying to delete a folder in my trash that contains no files or hidden files and nothing happens. It is still there.
However, when I try to delete everything in the folder in terminal I receive an error: Ti?ng Viê?t.html: No such file or directory. I can't find this file anywhere on my tiger... (1 Reply)
From within a directory, how do I determine whether I have write permission for it.
test -w pwd ; echo ?
This doesn't work as it returns false, even though I have write permission. (4 Replies)