Mount hard disk restricting permissions to particular users


Answer: 1

12 hours ago

How can I set one of my internal hard drives to automount at boot but with selective permissions? I would like my wife and I to have full access to it, but make it unavailable to the children's accounts. It is formatted as EXT4 and I am using Ubuntu 17.04

Added by: Natalia Cassin

Answer: 2

27 hours ago

I am assuming you only want to use this drive to store data. I'm also assuming your kids don't have sudo - obviously all bets are off if they do.

Choose a mount point for the drive and create it, for example

sudo mkdir /media/stuff

If the drive is already in your /etc/fstab, modify the line to use this mountpoint. You will need to use sudo to edit the file. Please make a backup copy before editing. See the fstab wiki page for more information.

If the drive is not in /etc/fstab, then add a line for it. First run

sudo blkid

And get the UUID for the drive. This is a long ugly string of characters. The new fstab line should be something like:

UUID=long-string-of-chars-from-blkid  /media/stuff  ext4 defaults 0 2

Now just set permissions on the mountpoint so that only root has execute permission on it. If a user has no execute permission on a directory, they cannot enter it or any directory below it.

sudo chmod 700 /media/stuff

Now add ACL permissions for yourself and your wife (replace me and mywife with the proper usernames).

sudo setfacl -m me:rwx /media/stuff
sudo setfacl -m mywife:rwx /media/stuff
Added by: Taya Nikolaus

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9