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

Re: [SOLVED] Re: Mount permissions weired



On Sat 12 Jul 2025 at 02:51:25 (+0000), David wrote:

> Again: when you mount something on a mountpoint, all underlying data of
> that mountpoint becomes hidden and inaccessible and irrelevant.

In linux, that isn't entirely true, as you can use a bind mount
to read what lies "underneath". (I haven't risked trying to write
to such a mountpoint, only reading from it.)

> [ … ] it has been my practice for some years now to 'chown root:' and
> 'chmod 0' on all my mountpoints and set the immutable bit on them, to avoid
> accidentally writing into directories that are intended only as
> mountpoints.

I've never seen the need for that. All but one of my mountpoints are
either /mnt/ itself or directories created under /media/. In fact,
the remaining mountpoint directory, /home, contains a severely
cut-down version of my home directory containing just two files,
.profile and .bashrc. The latter reads:

  # ~/.bashrc for unmounted /home directories
  # If not running interactively, don't do anything
  case $- in
      *i*) ;;
        *) return;;
  esac
  printf '%s\n' "Warning: /home is not yet unlocked and mounted."
  printf '%s\n' "         You need to mount /home by logging in as user 'unlock'."
  printf '%s\n' "         That will ask you for unlock's password first, and then"
  printf '%s\n' "         for the passphrase to decrypt /home. You will be logged"
  printf '%s\n' "         off whether or not the passphrase is correct, so that"
  printf '%s\n' "         you can log in again as $USER or unlock, as appropriate."
  printf '%s\n' "         So please logoff now."

I see that message only if I accidentally login before I have mounted
the real /home, in an encrypted partition.

Cheers,
David.


Reply to: