LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   why can I not delete a file I own?? (https://www.linuxquestions.org/questions/linux-newbie-8/why-can-i-not-delete-a-file-i-own-4175445921/)

sneakyimp 01-16-2013 03:22 PM

why can I not delete a file I own??
 
I logged into my server as user wordpressdev via ssh. I want to delete a file that belongs to wordpressdev but cannot:
Code:

[wordpressdev@host html]$ ls -al error_log
-rw-rw-r-- 1 wordpressdev apache 81746 Jan 15 19:57 error_log
[wordpressdev@host html]$ whoami
wordpressdev
[wordpressdev@host html]$ rm error_log
rm: cannot remove `error_log': Permission denied

WHAT THE HECK? It's pretty urgent that I sort this out. I need to delete all these files ASAP. Any help would be truly appreciated.

this also baffles:
Code:

[wordpressdev@host html]$ getfacl error_log
# file: error_log
# owner: wordpressdev
# group: apache
user::rw-
group::rw-
other::r--


unSpawn 01-16-2013 03:49 PM

Probably ownership of the "html" directory the file resides in?

linosaurusroot 01-16-2013 03:51 PM

Look at the access to the current directory rather than the file.
Code:

ls -ld

sneakyimp 01-16-2013 04:17 PM

You guys are both correct. Sorry for posting such a basic thing. The ownership of the directory was ok (root:wordpressdev) the problem was that it was 755 rather than 775. Sorry to trouble!

David the H. 01-18-2013 06:42 AM

The file permissions control access to the contents of the file.
The directory permissions control access to the contents of the directory.

A "directory" is really just a special kind of file; one that contains a list of the other files "in" it. If you have permission to alter this list, then you can add, delete, or rename a file, even if you don't have permission to access its contents (and vice-versa).

http://content.hccfl.edu/pollock/AUn...ermissions.htm

sneakyimp 01-18-2013 09:47 AM

Quote:

Originally Posted by David the H. (Post 4872833)
The file permissions control access to the contents of the file.
The directory permissions control access to the contents of the directory.

A "directory" is really just a special kind of file; one that contains a list of the other files "in" it. If you have permission to alter this list, then you can add, delete, or rename a file, even if you don't have permission to access its contents (and vice-versa).

http://content.hccfl.edu/pollock/AUn...ermissions.htm

Thanks, David. I was actually aware of that. I just wasn't looking closely enough at the ls -l results to see all the little w's, r's, and x's.


All times are GMT -5. The time now is 11:31 PM.