更改挂载驱动器上的目录所有权

mxp*_*usb 6 permissions root mount

我设置了双启动 Windows 10/Xubuntu 16.04。两者都共享用于启动的小型 SSD,并且在数据驱动器上都有主目录。

对于 Xubuntu,/dev/sdc是数据驱动器,它安装在/mnt/archives. 当我usermod -d /mnt/archives/mike mike反对我的用户将我的主驱动器移动到数据驱动器时,它在重新启动后工作正常。当我最初更改我的主目录时,我在/dev/sdcid=0,gid=0挂载了所有内容,它以 root 身份挂载所有内容。我将安装更改为id=mike,gid=mount_group,并重新启动了我的计算机。但是,当我去运行时sudo chown -R mike:mount_group /mnt/archives/mike/*,它实际上并没有改变任何权限。:/

这是我的/etc/fstab文件:

# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdd3 during installation
UUID=8db38c8f-87b6-4174-a439-fd60dbb7b313 /               ext4    errors=remount-ro 0       1
/dev/sdc /mnt/archives auto rw,relatime,user_id=mike,group_id=mount_group,allow_other,blksize=4096
Run Code Online (Sandbox Code Playgroud)

以下是该目录的示例:

# ls -lah /mnt/archives/mike/
total 88K
drwxrwxrwx 1 root root 8.0K Oct 23 15:50 .
drwxrwxrwx 1 root root 4.0K Oct 23 14:30 ..
drwxrwxrwx 1 root root    0 Oct  3 23:05 .adobe
drwxrwxrwx 1 root root 4.0K Oct  3 23:36 anaconda2
drwxrwxrwx 1 root root    0 Oct  9 00:14 .astropy
drwxrwxrwx 1 root root    0 Oct  9 00:19 .aws
-rwxrwxrwx 1 root root 6.5K Oct 23 15:49 .bash_history
-rwxrwxrwx 1 root root  220 Oct  3 22:24 .bash_logout
-rwxrwxrwx 1 root root  948 Oct 23 14:33 .bash_profile
-rwxrwxrwx 1 root root 3.8K Oct 23 14:34 .bashrc
-rwxrwxrwx 1 root root 3.7K Oct  3 23:36 .bashrc-anaconda2.bak
drwxrwxrwx 1 root root 4.0K Oct 23 16:01 .cache
drwxrwxrwx 1 root root    0 Oct  8 17:21 .conda
...
Run Code Online (Sandbox Code Playgroud)

如何解决这个奇怪的权限问题?

L. *_*mes 5

问题出在你的chmod -R指挥上。命令中的 不包括空间的*实际部分。mike/默认情况下,在预期的直接目录中看*不到点。.

这些命令将实现您正在寻找的目标。首先,用户经常错误地更改其家庭根目录或其空间中的某些文件和文件夹的所有者。这可以通过以下方式纠正:

$ sudo chown -R $USER:$USER ~/
Run Code Online (Sandbox Code Playgroud)

或者对于您问题中的命令,请使用以下命令:

$ sudo chown -R mike:mount_group /mnt/archives/mike/
Run Code Online (Sandbox Code Playgroud)