0

Two users user1 and user2 are registered on the server, both with sudo access.

user1 mounted a hard drive with:

$ sudo mount /dev/sda /media/user1/DATA
$ ll /media/user1
total 12K
drwx------ 19 user1 user1 4.0K 2020-01-25 23:44:42 DATA

How can we make sure that user2 has access to /media/user1/DATA?

No need to have a solution that persists upon reboot (for example editing /etc/fstab), nor something like chmod -R 777 on all the files on this hard drive.

Thanks

1 Answers1

0

I actually found the answer on: https://www.2daygeek.com/how-to-configure-access-control-lists-acls-setfacl-getfacl-linux/

With Linux, there is something called ACL: Access Control Lists. So to solve my problem, I ran:

setfacl -m u:user2:rwx /media/user1/DATA

After running this command, user2 had access to /media/user1/DATA.

To list the ACL of a directory, simply do:

getfacl /path/to/dir