Re: File permission confusion [Debian 9.1 with MATE]
- Date: Mon, 1 Jan 2018 19:29:46 +0100
- From: <tomas@xxxxxxxxxx>
- Subject: Re: File permission confusion [Debian 9.1 with MATE]
-----BEGIN PGP SIGNED MESSAGE-----
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
> -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.
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
-----END PGP SIGNATURE-----