Dolphin doesn't care about file read-only permission?

I’m running oS 11.3 KDE 4.6.3.

If I try to delete a read-only file in the terminal I can, but get a warning message I have to confirm:


blimmer@Bruno-03:~> ls -l test*
-r--r--r-- 1 blimmer users 79408 Jun 10 21:00 test file.txt

blimmer@Bruno-03:~> rm test*
rm: remover arquivo comum "test file.txt" protegido contra escrita? y

blimmer@Bruno-03:~> ls -l test*
ls: impossível acessar test*: Arquivo ou diretório não encontrado

blimmer@Bruno-03:~>

In Dolphin the file is simply sent to trash, no warning. I couldn’t find a setting in Dolphin configuration options to change this. I do have “Ask for confirmation …when moving files and folders to trash” unchecked, but even so, if the file is read-only???

Sorry, what do you want it to do?

If you leave: “Ask for confirmation …when moving files and folders to trash” unchecked
It’ll not ask.

If you leave: “Ask for confirmation …when moving files and folders to trash” checked
It’ll ask

The same if you enable the delete in the context

But this was a read-only file, as you can see in the listing.

I thought it wouldn’t be moved to trash or deleted, at least without a warning. Isn’t that one of the things that no-write-permission means?

But there is a warning.
‘Are you sure you want to…?’

In the terminal, or in Dolphin if the “confirm move/delete” thing is checked - and then to every file, read-only or not. BUT if it’s not checked then Dolphin will move read-only files without warning. Got it now?

What I’d like to know is if there is some setting I don’t know of to change this (on further looking it seems there isn’t), as it does seem strange to me that one app would move or write off a read-only file. Other apps don’t, if I open the text file with kwrite, for example, and try to save it will fail, as it should. That’s why Dolphin behavior seem strange to me.

As far as I understand things:
Read / Write is one thing
You have to consider Owner and or Group too.

I don’t see any abnormal behaviour here.

Perhaps peculiar is a better word. It is weird that read-only files can be trashed without warning. But then, I’m repeating myself.

It is weird that read-only files can be trashed without warning
If you have permissions… Yes you can

What you are saying is read-only should prevent that, even if you have permission? (owner/user/group)

I have to admit it’s not something I’m that clued up on. Someone like @ken_yap might be better able to explain.

On Sat, 11 Jun 2011 04:06:02 +0000, brunomcl wrote:

> caf4926;2351990 Wrote:
>> ‘Are you sure you want to…?’
>
> In the terminal, or in Dolphin if the “confirm move/delete” thing is
> checked - and then to every file, read-only or not. BUT if it’s not
> checked then Dolphin will move read-only files without warning. Got it
> now?
>
> What I’d like to know is if there is some setting I don’t know of to
> change this (on further looking it seems there isn’t), as it does seem
> strange to me that one app would move or write off a read-only file.
> Other apps don’t, if I open the text file with kwrite, for example, and
> try to save it will fail, as it should. That’s why Dolphin behavior seem
> strange to me.

Are you the owner of the file?

If you are, then the chances are that when it fails, it changes the
permissions and then performs the operation.

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

That’s a very different issue. You cannot write to a read-only file. You also cannot remove a file from a read-only directory. But as long as the directory is writable, you can remove the file from that directory.

At the command line with “rm” you are only being warned because this is sometimes a mistake. When you do it in a file manager, isn’t the file simply moved to trash where you can rescue it if that was a mistake?

On 06/11/2011 07:06 AM, nrickert wrote:
>
> That’s a very different issue. You cannot write to a read-only file.
> You also cannot remove a file from a read-only directory. But as long
> as the directory is writable, you can remove the file from that
> directory.

yes! this is the key to @brunomcl’s apparent dilemma!!

the system’s decision of if a certain user can read or write a certain
file is carried in the permissions of that file…

but, the system’s decision of if a certain user can delete any file in a
certain directory then those permissions are carried in the permissions
of that directory…

hence, a directory marked as drwxr-xr-x and owned by me will allow me to
delete anything inside, EVEN if i have not allowed myself to write
inside the file (read only)

i know it is kinda confusing, but think about it the difference between
who can write inside a file, and who can read/write and even destroy
files inside a directory…


dd CAVEAT: http://is.gd/bpoMD
via NNTP openSUSE 11.4 [2.6.37.6-0.5] + KDE 4.6.0 + Thunderbird 3.1.10
Acer Aspire One D255, 1.66 GHz Atom, 1 GB RAM, Intel Pineview graphics

  • When your gecko is broken you have a reptile dysfunction! *

I am, but I also set it to

-r–r–r–

as you can see in the first post. So I thought it should be read-only for me, group and others. But I can delete it without warning.
By the way, the same thing happens in windows XP - just tested in a VM. It seems to be a cross-platform consensus…

Beautifully explained, thanks.

Well, yes, but it’s also where I can unknowingly destroy it forever. The file went to trash with the same permissions (r/r/r) and after a quick right-click->empty trash it was gone forever.

OK, it’s no big deal once you are aware of it. I have some multimedia directories with many files I’m always emptying to open space, but want to preserve a few, usually the same (like the folder.jpg file in a xbmc shared directory). I set a few to ro, did a CTRL+A SHIFT+DEL and they where gone. That’s why I posted.

It is very true that many people do not understand that deleting a file from a directory only needs write access to the directory (and not to the file). The message from rm is to protect you against this conception error in your mind But if you think this paternalistic, *rm -f *will circumvent this protecting behaviour. From man rm:

Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or --interactive=always option is given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped.
Thus even a plain rm will remove when it is not typed from a terminal.

The behaviour of any file manager is independent from *rm. *Different programs, different programmers, different designers. Thus compairing that behaviour is useless. If you want a different behaving *rm, *write it yourself, if you want a different bahaving file manager, write it. That is how OS works.

On Sat, 11 Jun 2011 08:36:03 +0000, brunomcl wrote:

> hendersj;2352011 Wrote:
>> Are you the owner of the file?
>>
>> If you are, then the chances are that when it fails, it changes the
>> permissions and then performs the operation.
>>
>>
> I am, but I also set it to
>> -r–r–r–

Yes, I saw that - but the thing is that if you are the owner, some
programs will override the permissions by changing them (since the owner
can) and then performing the operation. I’d guess that’s what’s
happening here.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

No Jim,
There is no need to overwrite anything. When somebody has write access to a directory, he may delete files there, create files there, change access-bits of files there, etc. That is what write access to a directory means, that you can change the administrative items there (there isn’t much more). You do not have to be the owner of those files in that directory or have any access allowance to them (exept when the “restricted deletion flag” is set for that directory as is done for* /tmp*). You do not write to a file when you delete it, you only write in the directory.

What you probably mean is that when you may not write to a file and when you may write to the directory it is in, you may be asked by e.g. an editor if you realy want to write to it, it being read-only for you. When you say yes, that editor will then do the equivalent of a chmod +r, write he file and do the equivlent of a *chmod -r *to restore the status. It does in other words do what you would do: open a second terminal, do the chmod +, back to the first terminal and do the write, and then do the chmod - in one of the terminals as you think tthe status mus be restored. It realy does not do anything against the access rules, how could it be.

On Sat, 11 Jun 2011 19:06:03 +0000, hcvv wrote:

> hendersj;2352201 Wrote:
>> On Sat, 11 Jun 2011 08:36:03 +0000, brunomcl wrote:
>>
>> > hendersj;2352011 Wrote:
>> >> Are you the owner of the file?
>> >>
>> >> If you are, then the chances are that when it fails, it changes the
>> >> permissions and then performs the operation.
>> >>
>> >>
>> > I am, but I also set it to
>> >> -r–r–r–
>>
>> Yes, I saw that - but the thing is that if you are the owner, some
>> programs will override the permissions by changing them (since the
>> owner
>> can) and then performing the operation. I’d guess that’s what’s
>> happening here.
>>
>> Jim
>>
>> –
>> Jim Henderson
>> openSUSE Forums Administrator
>> Forum Use Terms & Conditions at ‘openSUSE Forums FAQ’
>> (http://tinyurl.com/openSUSE-T-C)
> No Jim,
> There is no need to overwrite anything. When somebody has write access
> to a directory, he may delete files there, create files there, change
> access-bits of files there, etc. That is what write access to a
> directory means, that you can change the administrative items there
> (there isn’t much more). You do even have to be the owner of those files
> in that directory or have any access allowance to them (exept when the
> “restricted deletion flag” is set for that directory as is done for-
> /tmp-). You do not write to a file when you delete it, you only write in
> the directory.

Oh, yes, I see what you’re saying. I was thinking in terms of just the
file itself - if the user doesn’t have w rights to the file, then the
shell prompts for deletion/overwriting (for example, vi can be forced to
overwrite a file that the user doesn’t have w rights to if they’re the
owner), but you can’t cat into the file.

But yes, the directory would be the appropriate place to restrict if you
absolutely wanted to deny rights to delete the file.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

But yes, the directory would be the appropriate place to restrict if you
absolutely wanted to deny rights to delete the file.
You can not deny rights to delete only one file in a directory. You can only deny the rights to change anything in a directory (wiith it’s w-bits and those are in the directory above the directory we talk about) and that includes creating new files, deleting any of it’s files (and not just a particular one), changing acess bits, owner, group of existing files, changing time stamps, in short changing anything that describes the files that are in that directory and all at the same time according to the w-bits of this directory (which are, I repeat, in the directory above this one).

henk@boven:~/test> l blob
total 8
dr-x------ 2 henk   wij 4096 Jun 11 22:10 ./
drwxr-xr-x 3 henk   wij 4096 Jun 11 22:13 ../
---------- 1 henk   wij    0 Jun 11 22:09 mine
---------- 1 marian wij    0 Jun 11 22:09 notmine
henk@boven:~/test>

In the listing above we see that user henk, which is running this, is owner of ./ (which is blob) and …/ (which is test). He may write to test, but he may not write to blob.
We see also that inside blob are mine and notmine. henk is the owner of mine and marian (my wife, nice to meet you) is owner of *notmine. *Nobody can read/write/execute these files.

henk@boven:~/test> rm blob/*
rm: remove write-protected regular empty file `blob/mine'? y
rm: cannot remove `blob/mine': Permission denied
rm: remove write-protected regular empty file `blob/notmine'? y
rm: cannot remove `blob/notmine': Permission denied
henk@boven:~/test>

Now henk tries to delete all files in *blob. *The rm tool warns because it thinks henk may be dumb in wanting to delete a file that is write protected for him. This is not because it thinks it can do it, but because it is cautious. henk is stubborn and says y. Now we see that rm can not do it because henk has no write access to blob.

henk@boven:~/test> chmod u+w blob
henk@boven:~/test> l blob
total 8
drwx------ 2 henk   wij 4096 Jun 11 22:10 ./
drwxr-xr-x 3 henk   wij 4096 Jun 11 22:13 ../
---------- 1 henk   wij    0 Jun 11 22:09 mine
---------- 1 marian wij    0 Jun 11 22:09 notmine
henk@boven:~/test>

Next step, henk makes blob writable for the owner (which is henk). See the owner w bit for ./
He is allowed to do this because …/ (test) is write enabled for the owner henk.

henk@boven:~/test> rm blob/*
rm: remove write-protected regular empty file `blob/mine'? y
rm: remove write-protected regular empty file `blob/notmine'? y
henk@boven:~/test> l blob
total 8
drwx------ 2 henk wij 4096 Jun 11 22:27 ./
drwxr-xr-x 3 henk wij 4096 Jun 11 22:13 ../
henk@boven:~/test>

Now henk repeates his delete and rm again thinks he may be stupid (computers never learn anything). Now mine and notmine are gone, not because any write access to those files is given, but because henk has write access to blob.

To get rid of those warnings one could use *rm -f *instead of rm. Plaese try this.

HTH

On Sat, 11 Jun 2011 21:06:02 +0000, hcvv wrote:

> To get rid of those warnings one could use -rm -f -instead of -rm-.
> Plaese try this.

I did try a number of things, clearly your picture is the more complete
and correct. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C