If I copy a file from my home folder to a shared NTFS drive, the copy is owned by root. I’m not using sudo or anything. I get the same result if I use Nemo to copy.
Is it something wrong with he way the drive is mounted?
~
touch testfile
~
cp testfile /mnt/M/
~
ls -l testfile
-rw-r--r-- 1 me me 0 Mar 23 14:18 testfile
~
ls -l /mnt/M/testfile
-rwxrwxrwx 1 root root 0 Mar 23 14:19 /mnt/M/testfile
The Linux concepts of ownership and permissions don’t apply to NTFS. This means that chown and chmod won’t work for changing the ownership or permissions for NTFS.
If I am not mistaken, an NTFS partition will mount with owner:group as root but with permissions 777 as can be shown by
That means everybody can read-write-execute any files.
However you could set Linux compatible permissions via fstab:
So permissions are not part of the file itself, they’re managed by the file system? makes sense, I just never thought about it.
Interestingly, if I copy the file back to its original location, it gets assigned -rwxr-xr-x me me, which sounds reasonable if it’s lost the original permission info.
i’ve also found that wrapping the file in an archive seems to preserve the permissions of the files inside somehow (just tried with 7z a).
I’ll look into your link for Windows sharing, that sounds useful.