简体   繁体   English

为多个用户授予对文件夹/文件的相同访问权限

[英]Give same access to folders/files for multiple users

I need to manage multiple ssh users for different Heroku accounts, explained here . 我需要为不同的Heroku帐户管理多个ssh用户,如此处所述 I've created different users and logging in to Heroku with those works fine. 我已经创建了不同的用户,并使用这些用户正常登录到Heroku。 These are the users I have: 这些是我的用户:

computer_owner (admin rights)
user1          (admin rights)
user2          (admin rights)

But I want user1 and user2 to share the same files and folders as computer_owner , ie all folders/files. 但是我希望user1user2computer_owner共享相同的文件和文件夹,即所有文件夹/文件。 Is this possible and if so, how do I do this? 这可能吗,如果可以,我该怎么做?

OS X is a UNIX compliant operating system. OS X是UNIX兼容操作系统。 If you set the rights on files and folders correctly, you can provide access to all of the users. 如果正确设置了文件和文件夹的权限,则可以为所有用户提供访问权限。 There's a tutorial here on how to manage the access rights and many more around if you search for something like "Unix Permissions" 如果您搜索“ Unix Permissions”之类的内容, 这里有一个有关如何管理访问权限的教程。

Ideally, create a separate group using dscl and add the required members. 理想情况下,使用dscl创建一个单独的组并添加所需的成员。 Next, set the files to be owned by that group and each will have access to those files 接下来,将文件设置为该组的所有者,每个文件都将有权访问这些文件

So, an example would be something like this: - 因此,示例将是这样的:-

# create the group
sudo dscl . create /Groups/heroku_ssh

# add members
sudo dscl . append /Groups/heroku_ssh GroupMembership computer_owner
sudo dscl . append /Groups/heroku_ssh GroupMembership user1    
sudo dscl . append /Groups/heroku_ssh GroupMembership user2

Assuming a directory called testDirectory: - 假设一个名为testDirectory的目录:-

# set full permissions for the owner and group
# 770 is read, write and execute for owner and group
sudo chmod -R 770 testDirectory

# set ownership of a file
sudo chown -R computer_owner:heroku_ssh testDirectory

This sets the owner to be the user computer_owner and the group heroku_ssh, so the owner and any member in the group can access the files in testDirectory 这将所有者设置为用户computer_owner和组heroku_ssh,因此所有者和组中的任何成员都可以访问testDirectory中的文件。

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

相关问题 如何让 Apache 访问 MAC OSx 上的文件夹? - How do I give Apache Access to folders on MAC OSx? OSX:将文件复制到具有相同名称的文件夹 - OSX: Copying files to folders with same name 将多个文件夹中的文件复制为一个 - Copy files from multiple folders into one Applescript:创建文件夹/子文件夹并移动多个文件 - Applescript: Create folders/subfolders and move multiple files 为所有用户OSX授予对某些节点模块的访问权限 - Give access to some node module for all users OSX 在 Mac 上将多个文件夹中的文件合并到一个文件夹中或在 R 中同时读取不同文件夹中的多个文件 - Combine files in multiple folders into one folder on Mac or read multiple files in different folders simultaneously in R 使用Apple Script将多个文件夹中的多个文件移动到一个文件夹 - Using Apple Script to move multiple files from multiple folders to one 如何在 macOS 上的 Sublime Text 中在同一窗口中打开文件和文件夹? - How to Open files and folders in same window in Sublime Text on macOS? 为什么文件夹中的文件之间的符号链接相同? - Why have symbolic links between files in folders at same depth? 仅Apache .py文件提供禁止访问的CGI - Apache ONLY .py files give access forbidden, cgi
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM