One area that causes confusion is mount points permissions. It makes absolutely no difference what permissions and ownership are set on a mount point before a filesystem is mounted there, as it acquires the permissions of the root directory of the filesystem that you mount.
How you change things for the top-level directory of a filesystem depends on its type. In the case of Linux filesystems, this is simple: mount it and then use chmod or chown to set it up as you want. These settings will then apply whenever you subsequently mount that filesystem.
Windows filesystems, such as FAT on USB sticks, are treated differently. FAT has no concept of file ownership and NTFS has a system that's incompatible with Linux permissions, so the filesystem driver imposes default permissions.
These generally set all files and directories as owned by the user that mounted the device, otherwise you couldn't write to it. The file permissions usually default to rwxr-xr-x (or 755 if you prefer) by the automounter.
If you are mounting a filesystem manually, then use the uid option to set up the appropriate ownership rights and umask for default permissions, like this:
sudo mount /dev/sdb1 /mnt/removable -o uid=john,umask=022
The umask is subtracted from 777 to give the permissions, 755 in this case. A umask of 0 will enable all permissions.
Are you a pro? Subscribe to our newsletter
Sign up to the TechRadar Pro newsletter to get all the top news, opinion, features and guidance your business needs to succeed!