为什么手动操作和通过 fstab 操作时挂载卷的权限会有所不同?

为什么手动操作和通过 fstab 操作时挂载卷的权限会有所不同?

我有一台运行 Ubuntu 的家庭服务器,还有几台运行 Ubuntu 和 Windows 7 的计算机连接到它。我的主要 Ubuntu 机器出现问题,我移动到服务器的任何文件或目录都具有只读访问权限,这意味着我无法移动文件夹的内容。我现在发现,如果我通过“连接到服务器”手动安装,一切都很好,但如果我使用 fstab 连接,就会出现权限问题。

手动挂载和通过 fstab 挂载时,createmask 或权限设置有何不同?

以下是我的 fstab 中的一个示例:

//192.168.42.2/Fileserver   /media/theta    cifs    guest,uid=1000,iocharset=utf8   0   0

答案1

一个相当不安全和宽容的解决方案是,dir_mode=0777,file_mode=0666在之后立即添加guest,uid=1000,iocharset=utf8,使得位之后不留空格utf8

我鼓励您尝试更严格的设置,dir_mode=0755,file_mode=0644,看看是否适合您。

挂载选项在 中有描述man mount。除了 cifs 之外,手册页中写道:

Mount options for cifs
See the options section of the mount.cifs(8) man page (cifs-utils package must be installed).

man 8 mount.cifs告诉您所有您需要知道的信息,甚至更多。它还说(除其他内容外):

FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS
The core CIFS protocol does not provide unix ownership information or mode for files and directories. 
Because of this, files and directories will generally appear to be owned by whatever values the uid= or 
gid= options are set, and will have permissions set to the default file_mode and dir_mode for the mount.

相关内容