0

Enter into debian whose filesystem is ext4:

vim /tmp/sphinx.rst

sphinx tutorial
=====================
installation
---------------
::

 sudo apt-get install python3-sphinx

create a new project
--------------------------
::

    mkdir  mydoc
    cd mydoc
    sphinx-quickstart

Display sphinx.rst permission:

ls -al   sphinx.rst
-rwxrwxrwx 1 debian debian 261 Aug 17 11:54 sphinx.rst

It can be executed when to input the absolute path /tmp/sphinx.rst.

/tmp/sphinx.rst
/tmp/sphinx.rst: line 1: sphinx: command not found
/tmp/sphinx.rst: line 2: ====================================================================: command not found
/tmp/sphinx.rst: line 3: installation: command not found
/tmp/sphinx.rst: line 4: ---------------: command not found
/tmp/sphinx.rst: line 5: ::: command not found
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python-babel-localedata python3-alabaster python3-babel python3-imagesize
  python3-jinja2 python3-markupsafe sphinx-common
Suggested packages:
  python-jinja2-doc python3-sphinx-rtd-theme dvipng sphinx-doc
The following NEW packages will be installed:
  python-babel-localedata python3-alabaster python3-babel python3-imagesize
  python3-jinja2 python3-markupsafe python3-sphinx sphinx-common
0 upgraded, 8 newly installed, 0 to remove and 46 not upgraded.
Need to get 4,408 kB of archives.
After this operation, 23.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Change its permission as 644, it can be executed.

sudo chmod 644  sphinx.rst
/tmp/sphinx.rst
bash: /tmp/sphinx.rst: Permission denied

sdb2 is in ntfs format.

sudo blkid |grep sdb2
/dev/sdb2: LABEL="winntfs" UUID="284A29774A2942C4" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="292c184b-766f-4036-8fa0-5bcd936b85c2"

Mount it with /mnt/winntfs:

sudo mount /dev/sdb2  /mnt/winntfs

Copy /tmp/sphinx.rst in ext4 partition into ntfs partition.

cp /tmp/sphinx.rst /mnt/winntfs
ls -al  /mnt/winntfs/sphinx.rst
-rwxrwxrwx 1 root root 261 Aug 17 12:02 /mnt/winntfs/sphinx.rst
sudo chmod 644 /mnt/winntfs/sphinx.rst
ls -al  /mnt/winntfs/sphinx.rst
-rwxrwxrwx 1 root root 261 Aug 17 12:02 /mnt/winntfs/sphinx.rst

I can't revise file's mode in my debian, now reboot and enter into win10,set its permission as read and write, containing no execute.

enter image description here

Reboot and re-enter into debian, re-mount dev/sdb2,/mnt/winntfs/sphinx.rst still can be executed, how to set un-executable permission for the file sphinx.rst in ntfs partition in linux?

2 Answers 2

1

By default the ntfs-3g driver ignores the actual NTFS permissions and always shows fixed values (like the vfat driver). You can change those using the mount options fmask=0133, uid=1000, etc.

To activate full chown/chmod support, you need to mount with the option -o permissions or to create a valid .NTFS-3G/UserMapping file.

2
  • Both mount and ntfs-3g command contains no argument file_mode= in man mount and man ntfs-3g.
    – showkey
    Aug 17, 2020 at 6:26
  • Ah, right, I confused it with CIFS – it's fmask/dmask in ntfs-3g. Aug 17, 2020 at 6:34
0

Both mount and ntfs-3g command contains no argument file_mode= in man mount and man ntfs-3g.

sudo mount -o permissions /dev/sdb2  /mnt/winntfs

or

sudo ntfs-3g -o permissions /dev/sdb2  /mnt/winntfs  

They take same effect,then you can set file mode with sudo chmod 644 /mnt/winntfs/sphinx.rst,it can't execute.

You must log in to answer this question.

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