Results 1 to 5 of 5

Thread: chmod mounted usb stick file

  1. #1
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default 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.

    Code:
    # 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.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: chmod mounted usb stick file

    Quote Originally Posted by ionmich View Post
    openSUSE 13.2 64bit KDE 4.14.9

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

    Code:
    # 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).
    Henk van Velden

  3. #3
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default Re: chmod mounted usb stick file

    Quote Originally Posted by hcvv View Post
    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
    https://technet.microsoft.com/en-us/library/cc938928.aspx which tells me under the heading...
    HTML Code:
    Table 17.8 NTFS File Attribute Types
    ...that
    HTML Code:
    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?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: chmod mounted usb stick file

    Quote Originally Posted by ionmich View Post
    Security Descriptor
    Describes who owns the file and who can access it.
    [/HTML]

    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.
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: chmod mounted usb stick file

    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •