LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2013, 03:22 PM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
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--
 
Old 01-16-2013, 03:49 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Probably ownership of the "html" directory the file resides in?
 
Old 01-16-2013, 03:51 PM   #3
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Look at the access to the current directory rather than the file.
Code:
ls -ld
 
Old 01-16-2013, 04:17 PM   #4
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
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!
 
Old 01-18-2013, 06:42 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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
 
Old 01-18-2013, 09:47 AM   #6
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by David the H. View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script to get name of file, delete original file, rename blank file chrisgti Linux - General 11 09-15-2012 02:49 AM
Create the file, write into that file but can't delete file in Linux pandunr Linux - Newbie 3 06-15-2011 08:45 AM
file from install ffmpeg conflicts w/file from package fmpeg-libs: which to delete? ybalazs Linux - Software 0 10-27-2009 01:21 AM
Upload file to ftp server -vsftp- but can not delete or change the file once uploaded murattas6 Linux - Server 2 06-26-2009 06:00 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:32 PM.

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