0

I have a drive being mounted (either manually or automatically using usbmount) and I can't change the owner or modify the permissions on the mounted drive or folders/files within in order for Mono to write files to it. I keep getting an operation not permitted error. I have since removed the usbmount package and I'm trying to affect the permissions on the mounted drive.. can't touch it

$sudo chmod 777 Folder
drwx------  2 jroper jroper 16384 Sep 13 16:13 Folder/

jroper@ubuntu:/media/usb$ ll
drwxr-xr-x  4 root root 16384 Dec 31  1969 ./
drwxr-xr-x 12 root root  4096 Sep 13 16:30 ../
-rwxr-xr-x  1 root root     0 Sep 13 14:43 File.txt*
drwxr-xr-x  2 root root 16384 Sep 13 16:13 Folder/
drwxr-xr-x  2 root root 16384 Sep 13 14:23 System Volume     Information/
jroper@ubuntu:/media/usb$ sudo chmod 777 Folder
jroper@ubuntu:/media/usb$ ll
total 52
drwxr-xr-x  4 root root 16384 Dec 31  1969 ./
drwxr-xr-x 12 root root  4096 Sep 13 16:30 ../
-rwxr-xr-x  1 root root     0 Sep 13 14:43 File.txt*
drwxr-xr-x  2 root root 16384 Sep 13 16:13 Folder/
drwxr-xr-x  2 root root 16384 Sep 13 14:23 System Volume     Information/
jroper@ubuntu:/media/usb$ sudo chown jroper:jroper Folder
chown: changing ownership of ‘Folder’: Operation not permitted
jroper@ubuntu:/media/usb$ ll
total 52
drwxr-xr-x  4 root root 16384 Dec 31  1969 ./
drwxr-xr-x 12 root root  4096 Sep 13 16:30 ../
-rwxr-xr-x  1 root root     0 Sep 13 14:43 File.txt*
drwxr-xr-x  2 root root 16384 Sep 13 16:13 Folder/
drwxr-xr-x  2 root root 16384 Sep 13 14:23 System Volume     Information/
jroper@ubuntu:/media/usb$ sudo chgrp jroper Folder/
chgrp: changing group of ‘Folder/’: Operation not permitted
1
  • Possible workaround: copy the data to a drive that supports Unix permissions. Or, another possible workaround that may be much faster (if you have the know-how) and take up a lot less space: make symbolic links that point to the data for the bytes in the files, and have the symbolic links be stored on a Unix drive with alterable permissions.
    – TOOGAM
    Commented Sep 14, 2017 at 2:15

1 Answer 1

1

The presence of System Volume Information/ suggests the filesystem is NTFS. You probably use ntfs-3g, it runs as FUSE (i.e. in userspace).

As far as I know, by default it works in a way that doesn't support Linux permissions and ownership, that's why you cannot change them. (Note: in my Kubuntu neither chmod nor chown nor chgrp returns "Operation not permitted". Still none of them brings the desired effect.)

Effective values are set once (during mount) with uid=, gid=, umask=, fmask=, dmask= mount options.

There are also permissions, acl and usermapping= options. Check man 8 mount.ntfs-3g, especially User Mapping section. With these advanced options you may be able to change permissions and ownership and your changes will have effect in Windows as well.

Also note the allow_other option. It's doesn't really belong to ntfs-3g, it's a generic option of FUSE.

This option overrides the security measure restricting file access to the user mounting the filesystem.

Since you want to change ownership you may need to use this option so the new owner can access the filesystem in the first place. This article elaborates security concerns. From therein:

In this case, the filesystem runs with the privileges of the user that invoked it, not the privileges of any user who happens to make use of the filesystem. It's the responsibility of the user who mounts the filesystem to ensure inappropriate access privileges aren't being granted to other users.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .