External storage can be anything, but mostly files from FAT/NTFS systems. My hope was that it's possible to force permissions when copying from external sources.
Try the following experiment: Eveything you do here can be unmounted and un-done so it's not permamant.
Install bindfs:
Code:
sudo apt install bindfs
Create a mount point in say your home directory - can be anywhere:
Code:
mkdir /home/tester/MyMedia
Temporarily mount your /media/$USER directory to MyMedia using bindfs specifying a different set of permissions:
Code:
sudo bindfs -o perms=0660:+D,force-user=tester,force-group=tester,nonempty /media/tester /home/tester/MyMedia
I have a file labeled ntfs-test.txt located at /media/tester/DataN. Since it's formatted ntfs it will exhibit the default ntfs permissions:
tester@vxub2004:~$ ls -l /media/tester/DataN/ntfs-test.txt
-rwxrwxrwx 1 tester tester 0 Jun 13 08:07 /media/tester/DataN/ntfs-test.txt
If I look at the bindfs remount it will exhibit the permissions I specified:
tester@vxub2004:~$ ls -l /home/tester/MyMedia/DataN/ntfs-test.txt
-rw-rw---- 1 tester tester 0 Jun 13 08:07 /home/tester/MyMedia/DataN/ntfs-test.txt
If I were to copy that file from MyMedia/DataN to my Public folder it will retain the permissions set by bindfs:
tester@vxub2004:~$ cp /home/tester/MyMedia/DataN/ntfs-test.txt Public
tester@vxub2004:~$ ls -l Public/ntfs-test.txt
-rw-rw---- 1 tester tester 0 Jun 13 08:15 Public/ntfs-test.txt
To stop all this unmount it:
Code:
sudo umount /home/tester/MyMedia
You can set this up in fstab with a syntax change to have this "remount" happen at boot.
Bindfs creates an immutable "view" of something with a set of permissions that may differ from the source.
Bookmarks