进入文件系统为 ext4 的 debian:
vim /tmp/sphinx.rst
sphinx tutorial
=====================
installation
---------------
::
sudo apt-get install python3-sphinx
create a new project
--------------------------
::
mkdir mydoc
cd mydoc
sphinx-quickstart
显示sphinx.rst
权限:
ls -al sphinx.rst
-rwxrwxrwx 1 debian debian 261 Aug 17 11:54 sphinx.rst
输入绝对路径时可以执行/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]
将其权限更改为644
,即可执行。
sudo chmod 644 sphinx.rst
/tmp/sphinx.rst
bash: /tmp/sphinx.rst: Permission denied
sdb2
是ntfs
格式。
sudo blkid |grep sdb2
/dev/sdb2: LABEL="winntfs" UUID="284A29774A2942C4" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="292c184b-766f-4036-8fa0-5bcd936b85c2"
安装它/mnt/winntfs
:
sudo mount /dev/sdb2 /mnt/winntfs
将分区复制/tmp/sphinx.rst
到分区中。ext4
ntfs
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
我的debian无法修改文件的模式,现在重启进入win10,设置权限为read and write
,不包含execute
。
重启后重新进入debian,重新挂载dev/sdb2
,/mnt/winntfs/sphinx.rst
依然可以执行,sphinx.rst
linux下如何设置ntfs分区文件不可执行权限?
默认情况下,ntfs-3g 驱动程序忽略实际的 NTFS 权限并始终显示固定值(如 vfat 驱动程序)。您可以使用 mount options , 等来更改
fmask=0133
它们uid=1000
。要激活完整的 chown/chmod 支持,您需要使用该选项挂载
-o permissions
或创建一个有效的 .NTFS-3G/UserMapping 文件。and命令在
mount
and中不包含任何参数。ntfs-3g
file_mode=
man mount
man ntfs-3g
或者
它们具有相同的效果,然后您可以设置文件模式
sudo chmod 644 /mnt/winntfs/sphinx.rst
,它无法执行。