[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: File permission confusion [Debian 9.1 with MATE]



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jan 01, 2018 at 06:11:59PM -0000, Dan Purgert wrote:

[...]

> Note that "write" permissions on a file only really comes into play when
> you're messing with a file in an editor (e.g. vim, emacs, nano,
> whatever).  It does not necessarily prevent one from doing something
> like:
> 
>    -rw-r----- [...] somefile.txt
>    $ mv anotherfile.txt somefile.txt
> 
> Because you're not modifying "the file", but rather its parent
> directory.  It's a very, very fine distinction, to be sure.

And that's the point... a program "messing" with the file might
well choose to copy the file to some other name, modify that copy,
and then, at the end, remove the original and rename the new
version to the original name: this is actually a common pattern
to achieve some form of "atomicity": when you want either all
the changes "committed to disk" or none (in case of failure).

As long as the basic difference between a file and its "name"
(i.e. the directory entry "pointing" to the file) is not understood,
this fine difference between writing to the file and modifying
(e.g. deleting) the directory entry will seem mysterious.

Otherwise... nice tutorial.

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlpKfhoACgkQBcgs9XrR2kbJZACggJJacqgUGuj9Hc6tVjRzWycw
8t4An069sCaghVj3PynydUgoghliVEey
=88r8
-----END PGP SIGNATURE-----


Reply to: