Difference between revisions of "Tips and tricks cjc73"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
<!-- # <code>sudo chmod a-rwx /mnt/mountpoint</code> --> | <!-- # <code>sudo chmod a-rwx /mnt/mountpoint</code> --> | ||
# <code>sudo chattr +i/mnt/mountpoint</code> | # <code>sudo chattr +i/mnt/mountpoint</code> | ||
+ | |||
+ | |||
+ | === second transcluded heading === | ||
+ | |||
+ | foo bar |
Revision as of 18:08, 21 October 2021
Prevent accidental writes to mount point folders
Suppose you have a folder at /mnt/mountpoint that you would like to use as a mount point for a volume. Because the mount point is a valid path to a location on the boot volume, it is possible to write data to the mount point even when the volume is not mounted. Data written to the mount point will not be on the external volume --- it will be on the boot volume. It can a source of confusion, especially because copying data into the mount point and then later properly mounting a volume will hide any data on the boot drive that is in the mountpoint directory.
To avoid this, make the mountpoint directory unwritable so attempting to write data to the mountpoint when the volume is not mounted will generate an error.
sudo chattr +i/mnt/mountpoint
second transcluded heading
foo bar