如何将文件权限授予组中的特定用户? [英] How to give file permission to a specific user in a Group?

查看:167
本文介绍了如何将文件权限授予组中的特定用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有两个用户Alice和Bob的组"g1". 我想与两个人共享具有不同权限的文件"file1".(对于Alice只读,对于Bob读/写)

I have a Group 'g1' having 2 users Alice and Bob. I want to share a file 'file1' with both of them with different permissions.(for Alice read only and for Bob Read+write)

推荐答案

假设Bob可以拥有该文件,那么下面的内容应该对您有用.

Assuming Bob can own the file the following should work for you.

$ chown Bob:g1 file1

首先将文件的所有权设置为Bob,以允许读写访问,然后将组所有权设置为g1组.

First set the ownership of the file to Bob to allow for read+write access and set the group ownership to the g1 group.

$ chmod 640 file1 

将所有者设置为可读写,并将组设置为只读.这是Web服务器上的常见权限结构.请注意,世界"在此结构中没有权限,但是$ man chmod可以提供有关文件权限的更多信息,并使您到达需要的位置.另外,如果您需要对整个系统的权限进行更多控制,则可能需要查看Posix ACL或SE Linux,就像您确实表明自己在RedHat上一样

Set the owner to a read and write and set the group to read only. This is a common permission structure on webservers. Note that the "world" has no permissions in this structure, but $ man chmod can provide further information on file permissions and get you where you are needing to go. Additionally if you need more control over your permissions across the whole system you may want to look into Posix ACLs or SE Linux as you did indicate you are on RedHat

这篇关于如何将文件权限授予组中的特定用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆