Quantcast
Channel: Active questions tagged mount+fstab - Ask Ubuntu
Viewing all articles
Browse latest Browse all 699

Inheriting parent folder's permissions for new folders on mounted ext4 drive

$
0
0

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

  1. create mount point sudo mkdir /mnt/myhdd
  2. set ownership to user sudo chown -c $USER /mnt/myhdd
  3. set permission to user only sudo chmod 700 /mnt/myhdd
  4. 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
  5. reboot
  6. see Explenation

Viewing all articles
Browse latest Browse all 699

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>