On Tue, Jul 19, 2011 at 04:41:56PM +0100, Brett Parker wrote:
On 19 Jul 16:23, Chris G wrote:
On Tue, Jul 19, 2011 at 04:11:47PM +0100, Brett Parker wrote:
On 19 Jul 15:37, Chris G wrote:
I.e. if I have a file I own that is read only I *can't* delete it if I am the user that owns the file, even using 'rm -f', however if I sudo to root privileges then 'rm -f' will remove the file even if there is no write permission.
Can you delete the single file? If not, then, erm, dya wanna check what the *directory* permissions are, because if the user hasn't got write to the directory, they can't delete things.
Also, please check which rm is being called in each case: as user: which rm as root: which rm
If the output of those don't match, that'll be the problem, probably.
(certainly I, as a normal user, can happily rm -rf my files and directories)
Partly finger trouble on my part:-
I *can* remove read only files that I own using 'rm -f':-
chris$ ls -al total 16 drwxr-xr-x 2 chris chris 4096 2011-07-19 17:34 . drwxrwxrwx 29 chris users 12288 2011-07-19 17:33 .. -r--r--r-- 1 chris chris 0 2011-07-19 17:33 xxx -r--r--r-- 1 chris chris 0 2011-07-19 17:33 yyy -r--r--r-- 1 chris chris 0 2011-07-19 17:34 zzz chris$ rm xxx rm: remove write-protected regular empty file `xxx'? n chris$ rm -f xxx chris$ ls -l total 0 -r--r--r-- 1 chris chris 0 2011-07-19 17:33 yyy -r--r--r-- 1 chris chris 0 2011-07-19 17:34 zzz chris$
However, my original problem, 'rm -fr' *doesn't* remove a directory which itself is read only, if I am the user who owns the directory and files but if I get root privileges I can - what happens is as follows:-
chris$ ls -ald fred dr-xr-xr-x 2 chris chris 4096 2011-07-19 17:34 fred chris$ rm -fr fred rm: cannot remove `fred/yyy': Permission denied rm: cannot remove `fred/zzz': Permission denied chris$ sudo -s [sudo] password for chris: root$ rm -fr fred root$ ls fred ls: cannot access fred: No such file or directory