Are you trying to mount an external HDD to /media/david?
Can you post the output "
sudo fdisk -l" command?
If External HDD is formatted using NTFS filesystem then you need ntfs-3g package to mount NTFS partitions. So check whether that package is installed or not using
Code:
sudo dpkg -l | grep ntfs-3g
If it is not installed, install it using below commands
Code:
sudo apt-get update
sudo apt-get install ntfs-3g
After installation you can mount that NTFS partition(which will be usually sdb* or sdc*) using below command
Code:
sudo mount /dev/sdb1 /media/david -o uid=1000,gid=1000,dmask=027,fmask=027
or
sudo mount -t ntfs-3g /dev/sdb1 /media/david -o uid=1000,gid=1000,dmask=027,fmask=027
dmask is the mask for directories and fmask is the mask for files.
Here you no need either extra ACLs or chmod/chown commands to give read/write permissions to uid=1000, From above command by default the user & group who is having uid & gid as 1000 will get read, write & execute and read & execute permissions respectively to /media/david folder including all sub folders and others won't be having any permission on /media/david.
You can change permissions according to your needs by calculating with umask i.e
Code:
7 7 7 ---> full permission for all
0 2 7 ---> umask of owner, group and others
-----
7 5 0 ---> real permissions of files/folders of owner, group and otheres.
| | |-->Other don't have any permissions.
| |-->Group having read and execute permissions.
|-->Owner having full(read/write/excecute) permissions.
4 = read
2 = write
1 = execute
---------
7 = rwx
---------
If you are just trying to give access to /media/david folder without mounting any external HDD, then you can do it using chmod/chown only but
ACL would be fine which can set particular permission to particular user even that directory is not owned by either his name/group. Before running setfacl command make sure whether acl package is installed.
Code:
sudo dpkg -l | grep acl
You can install ACL using
Code:
sudo apt-get install acl
If ACL is not enabled for / then open /etc/fstab file and add acl to the end of the 4th field in the / partion line. Then your root partition line looks like below
Code:
UUID=e087b5ed-bcc7-416c-a1fa-4c80bb3a1082 / ext2 errors=remount-ro,acl 0 1
Now remount / using
Check whether now ACL is enabled for /.
Now you can run setfacl command
Code:
setfacl -m u:username:rwx /path
setfacl --help
For example
setfacl -R -m u:david:rwx /media/david