Problem:
If I create a new folder in my mounted HDD, the permission of that folder is not the same as all other folders on that drive. How do I set it up so that a newly created folder has the same permissions as its main folder.
Explanation:
I mounted my second HDD to /mnt/myhdd
with permission 0700 and created a folder on that HDD "esteban".
So only user esteban should be able to access the folder "esteban" and only user tim should be able to access folder "tim" (if user/folder tim would exist).
The HDD auto mounts at boot. When I check the permission of the mount point:
>>> ls -l /mnt/myhdd insgesamt 20drwx------ 12 esteban esteban 4096 22. Jul 15:29 estebandrwx------ 2 root root 16384 20. Sep 2019 lost+found
If I do it for the folder esteban:
>>> ls -l /mnt/myhdd/esteban insgesamt 56drwx------ 6 esteban esteban 4096 15. Jul 23:51 Documentsdrwx------ 13 esteban esteban 4096 21. Jul 20:47 Pictures
If I create a new folder in Nautilus in /mnt/myhdd/esteban
and check the permissions, it differs from all my other folders:
>>> ls -l /mnt/myhdd/esteban insgesamt 56drwx------ 6 esteban esteban 4096 15. Jul 23:51 Documentsdrwx------ 13 esteban esteban 4096 21. Jul 20:47 Picturesdrwxr-xr-x 2 esteban esteban 4096 22. Jul 15:29 Test
Mount Procedure
- create mount point
sudo mkdir /mnt/myhdd
- set ownership to user
sudo chown -c $USER /mnt/myhdd
- set permission to user only
sudo chmod 700 /mnt/myhdd
- add HDD to fstab
sudo nano /etc/fstab# My Storage:UUID=LONG-NUMBER /mnt/myhdd ext4 rw,nosuid,nodev,nofail,exec,auto,nouser,async,relatime 0 0
- reboot
- see Explenation