Can't delete user directory on CentOS

user1274113 picture user1274113 · Aug 10, 2012 · Viewed 7.2k times · Source

I'm stuck.

I did a simple useradd. I had user -> mark and assigned directory -> /home/mark. Here i've installed a software. Later I've deleted mark and now i can't delete /home/mark. With root account I tried to:

a) Change permission to 777 -> Permission denied

b) Delete directory with

rm -rf /home/mark

Permission denied

c) Nautilus

sudo nautilus 

Could not parse arguments: Can't open display (what??)

There's no way for me to remove this directory from my server. Here's my permissions list

ls -la /home/mark

drwx------ 5  502  502    4096 10 ago 13:32 .
drwxr-xr-x 5 root root    4096 10 ago 16:13 ..
-rwxrwxrwx 1  502  502     366 10 ago 13:46 .bash_history
-rwxrwxrwx 1  502  502      18 10 mag 20:45 .bash_logout
-rwxrwxrwx 1  502  502     176 10 mag 20:45 .bash_profile
-rwxrwxrwx 1  502  502     124 10 mag 20:45 .bashrc
drwxrwxrwx 2  502  502    4096 12 nov  2010 .gnome2
drwxrwxrwx 2  502  502    4096 10 ago 14:28 .mozilla
drwxrwxrwx 2  502  502    4096 10 ago 14:28 mypackage
-rwxrwxrwx 1  502  502 4131518 10 ago 05:06 mypackage.tar.gz

Any idea?

p.s. On GNOME when I right-click this folder (of course I can't open it) I see on Permissions tab that Owner and Group are still assigned to mark's ID. I can see Owner -> 502 - user #502 (it was mark) and Group -> 502. All forms are greyed-out and I can't edit them.

Answer

TOC picture TOC · Aug 10, 2012

To delete the user mark and his data (/hom/mark), as root type this:

#userdel -r mark

EDIT : try this

chattr -i mark
rm -rf mark

You said that you cannot chown this directory, if the command above does not work, i suggest fsck on the system:

#shutdown -r -F now

And try after checking the filesyetemn to remove the mark folder.