简体   繁体   English

限制对已安装设备的访问 (Linux)

[英]Restrict access on a mounted device (Linux)

The challenge is to allow access to only one directory on the mounted device for all users.挑战是只允许所有用户访问已安装设备上的一个目录。

I have an external hard drive.我有一个外置硬盘。 I mount it using the command我使用命令安装它

sudo mount -o umask=0007,gid=0,uid=0 /dev/sdb1 /mnt/SAMSUNG/

I need to make one directory available for reading/writing to other users on this device.我需要让一个目录可供此设备上的其他用户读/写。 I cannot do this via sudo chmod 777 /mnt/SAMSUNG/my_directory , the command has no effect.我无法通过sudo chmod 777 /mnt/SAMSUNG/my_directory执行此操作,该命令无效。

Is there some other way to do this?还有其他方法可以做到这一点吗? Maybe I'm doing something wrong?也许我做错了什么?

In your sudo chmod 777 /mnt/SAMSUNG/my_directory command you give在您提供的sudo chmod 777 /mnt/SAMSUNG/my_directory命令中

  • The user, rwx (Read, Write and Execute) permissions用户,rwx(读、写和执行)权限
  • The group, rwx permissions组,rwx 权限
  • And Everyone else rwx permissions和其他所有人 rwx 权限

Inside of /mnt/SAMSUNG/my_directory is the thought that there should be more directories that is specific for other accounts? /mnt/SAMSUNG/my_directory 内部是否认为应该有更多特定于其他帐户的目录?

If that is the case and the users are local you could do something like this:如果是这种情况并且用户是本地用户,您可以执行以下操作:

sudo chown someuser:someuser /mnt/SAMSUNG/my_directory/someusersdir && sudo chmod 770 /mnt/SAMSUNG/my_directory/someusersdir

When mounting the NTFS file system ( /mnt/SAMSUNG/ ), there is no possibility of mounting a specific directory.挂载 NTFS 文件系统 ( /mnt/SAMSUNG/ ) 时,不可能挂载特定目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM