Consider this example. I download a tar.gz file from the internet and open the contents of that file into a directory. Let's say I choose to remove the directory. Unfortunately, I do not have permission to delete the directory. What do I do? I get an error message that I don't have permission to remove this directory.
~$ cd /home/amathew
~$ sudo tar xzf hadoop-0.20.2.tar.gz
~$ sudo mv hadoop-0.20.2 hadoop
~$ sudo chown -R hadoop:hadoop hadoop
Thanks in advance.
EDIT:
~$ lsattr -RVadlv hadoop
lsattr 1.41.12 (17-May-2010)
2903294105 hadoop Extents
According to the commands you cite, you changed the ownership to user "hadoop" before you tried to delete it. Since user "amathew" no longer owns the directory, he does not have permission to delete it (unless there's a group relationship that's not specified here).
You should also modify permissions to that file by:
This way the file will be editable/deletable by anyone (which -of course- includes you).
After that, try to delete and succeed.
Good luck!
Glossary:
FOLDERNAME = change this for the folder name of your choice.
Just for the record: If the user has already changed the ownership of the folder, he can now run this with no hassle. Thank you!