chmod mounted usb stick file

openSUSE 13.2 64bit KDE 4.14.9

Could someone please explain why this does not work? Attributes did not change.

# mount /dev/sdb1 /mnt/usb
# ls -l /mnt/usb
total 1
-rwxrwxrwx 1 root root 13 Sep 14 15:34 x.txt
# chmod a-w /mnt/usb/x.txt
# ls -l /mnt/usb
total 1
-rwxrwxrwx 1 root root 13 Sep 14 15:34 x.txt
# 

Is there a way to set attributes on an NTFS formatted USB stick partition so that Windows users must be logged in as Administrator to write to it?

Thanks in advance.

NTFS is not a LINUX file system. There are no Linux things like ownership by user and group and permission bits maintained in it. And what is not there can not be changed.

What you see are fake user:group and permission bits. They are set during mount through the mount options. When the mount is through the desktop, these options are set by the desktop. Very clever by using the user:group from the user loged in in the desktop session where the mount is done for, and the permission in a way that the user can read and write, but not execute.

I do not know why you ask this, but when you stick to my mantra: “Use non-Linux file systems only for transfer of data between Linux systems and non-Linux systems (and thus never as a real part of your Linux system)”, you probably would not need to chmod on NTFS.

When you want to use an NTFS file sytem for the aformentioned data transfer for more users, than do not mount it using the desktop of one of those users, but mount it in the conventional way using a mount statement with the proper mount options (possibly assisted by an /etc/fstab entry that will hold most of the fields and options to make the mount easier to handle).

Thanks for the quick response. This was the first time I ever tried NTFS. I am trying to help Windows friends with USB sticks that come back deleted, broken, infected when I use FAT files.

I got to File Systems | Microsoft Learn which tells me under the heading…

Table 17.8 NTFS File Attribute Types

…that



Security Descriptor
Describes who owns the file and who can access it.

It sounded to me a lot like .ext4 attributes. Are they lying, or did I miss something?

In any case, these are not Unix/Linux owners and Unix/Linux permissions. And apparently there is no direct trandslation possible, else the NTFS drivers would handle for it. Be glad, when your NFTS file is owned by a Windows user (whatever that may be) that Windows user most probably will not exist on your openSUSE system, thus no access.

BTW it is not only ext4, these things (amongst others) have to be suported by all file system tyoes that want to be Unix/Linux compatible.

For a read: https://en.wikipedia.org/wiki/File_system_permissions :wink: