微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 权限被拒绝尝试附加到已挂载目录中的文件

我无法理解为什么我无法附加到python3(3.2.3)中的文件.我在共享文件夹中创建这些文件,但我无法附加到它们.我的主文件夹中的文件没有问题.共享文件夹权限是:

drwxrwxrwx  2 nobody   share       65536 2017-01-01 22:16 Pictures

我在’share’组中拥有所有权限:

groups alex
share www-data

我可以创建文件

>>> testFile=open ('VID_2.mp4','wb')
>>> testFile.close()

但我无法补充:

>>> testFile=open ('VID_2.mp4','ab')
Traceback (most recent call last):
  File "

我检查了文件权限,根据我的理解,我应该能够附加到该文件

ls -l
-rw-rw-rw- 1 alex share 0 2017-01-01 22:40 VID_2.mp4    

因此,我感到困惑的是,为什么拒绝追加许可,以及允许追加的许可是什么.

更新:
似乎问题不在于python脚本,因为如果我使用echo我得到相同的权限错误

touch myfile.txt
echo 1 > myfile.txt
echo 2 >> myfile.txt
-bash: myfile.txt Permission denied
ls -l myfile.txt
-rw-rw-rw- 1 alex share 2 2017-01-03 09:44 myfile.txt

更新2:

这些文件夹位于常规挂载(/ DataVolume)下:

/dev/sda4 on /DataVolume type ext4 (rw,noatime,nodiratime)
/DataVolume/cache on /CacheVolume type none (rw,bind)
/DataVolume/shares on /shares type none (rw,bind)
/DataVolume/shares on /nfs type none (rw,bind)

cat /proc/mounts
/dev/sda4 /DataVolume ext4 rw,nodiratime,barrier=1,data=ordered 0 0
/dev/sda4 /CacheVolume ext4 rw,data=ordered 0 0
/dev/sda4 /shares ext4 rw,data=ordered 0 0
/dev/sda4 /nfs ext4 rw,data=ordered 0 0

我可以附加到/ DataVolume / home / alex中的文件,但不能附加到/ DataVolume / shares下的文件中:

ls -l /DataVolume/
drwxrwxr-x  4 root root      65536 2013-11-14 21:15 home
drwxrwxr-x  7 root share     65536 2017-01-04 10:16 shares
ls -l /DataVolume/home/
drwxr-xr-x 7 alex   share 65536 2017-01-01 22:24 alex
ls -l /DataVolume/home/alex
-rw-rw-rw- 1 alex share     4 2017-01-04 10:20 test.txt
ls -l /DataVolume/shares/
drwxrwxrw-  2 alex   share 65536 2017-01-04 10:23 test

编辑:我不再有问题的设备,所以我将无法再验证任何建议.

最佳答案
检查您的umask设置,该文件在创建后未获得可执行权限. umask 002应该解决这个问题.

-rw-rw-rw- 1 alex share 2 2017-01-03 09:44 myfile.txt

原文地址:https://www.jb51.cc/linux/440980.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐