如何在Ubuntu服务器上继承权限?

时间:2023-01-20 21:16:36

Sorry for the second newbie question, I'm a developer not a sysadmin so this is all quite new to me. I hope I can explain myself clearly! Here goes.

对不起第二个新手问题,我是开发人员而不是系统管理员,所以这对我来说都是新手。我希望我能清楚地解释自己!开始。

Here's what I did:

这是我做的:

  • Logged into the root account

    登录到root帐户

  • Created the accounts 'richard' and 'austin'

    创建帐户'richard'和'austin'

  • Created the group 'developers', and added 'richard' and 'austin' to it

    创建了“开发者”组,并添加了“richard”和“austin”

  • Created the directory /server, and used "chown richard:developers /server" to change the owner

    创建了目录/服务器,并使用“chown richard:developers / server”来更改所有者

  • Changed the permissions of /server to drwxrwxr-x (so the group can write to it)

    将/ server的权限更改为drwxrwxr-x(以便组可以写入)

  • Logged out of the root account, and into the 'richard' account

    退出root帐户,并进入'richard'帐户

  • Created the directories /server/production and /server/staging

    创建目录/ server / production和/ server / staging

  • Used "ls -l" inside /server to list the contents, and found permissions of drwxr-xr-x and ownership of "richard:richard" for both /server/production and /server/staging. Consequently, 'austin' can edit inside the /server directory, but not inside the directories 'richard' created.

    在/ server内部使用“ls -l”列出内容,并为/ server / production和/ server / staging找到drwxr-xr-x的权限和“richard:richard”的所有权。因此,'austin'可以在/ server目录中编辑,但不能在创建的目录'richard'中编辑。

What am I doing wrong? I want to ensure that any files or folders created inside the /server directory have group write permissions and belong to the developers group. How do I go about that?

我究竟做错了什么?我想确保在/ server目录中创建的任何文件或文件夹都具有组写权限并属于开发人员组。我该怎么做?

Thanks for any help!

谢谢你的帮助!

4 个解决方案

#1


4  

Looks like you want to use "chmod g+s" or "chmode 2775" to get the SetGID bit set on the directory, that should preserve the group if I remember my permission modes properly.

看起来你想使用“chmod g + s”或“chmode 2775”来获取目录上设置的SetGID位,如果我正确记住我的权限模式,应该保留该组。

#2


1  

When you created the directories as richard the system assumed that you were the owner and set you as the owner, you can either change the ownership and permissions manualy

当您创建目录为richard时,系统假定您是所有者并将您设置为所有者,您可以手动更改所有权和权限

sudo chown richard:developers
sudo chmod 775

or
set the default permissions for creating files/folders (found this: http://wiki.slicehost.com/doku.php?id=setting_up_ubuntu_slice_with_django_postgresql_ledgersmb_and_openvpn)
or
use acl's (see: http://ubuntuforums.org/showpost.php?p=3718480&postcount=12) for details

或者设置创建文件/文件夹的默认权限(找到这个:http://wiki.slicehost.com/doku.php?id = setting_up_ubuntu_slice_with_django_postgresql_ledgersmb_and_openvpn)或使用acl(参见:http://ubuntuforums.org/showpost.php? p = 3718480&postcount = 12)了解详情

#3


0  

How did you change the permissions of /server? Do it recursively, if you didn't.

你是如何改变/ server的权限的?如果不这样做,那就递归一次。

Good luck!

#4


0  

you must have set a restrictive umask

你必须设置一个限制性的umask

edit ~/.bash_profile

and modify the umask setting for the specific user.

并修改特定用户的umask设置。

http://en.wikipedia.org/wiki/Umask

#1


4  

Looks like you want to use "chmod g+s" or "chmode 2775" to get the SetGID bit set on the directory, that should preserve the group if I remember my permission modes properly.

看起来你想使用“chmod g + s”或“chmode 2775”来获取目录上设置的SetGID位,如果我正确记住我的权限模式,应该保留该组。

#2


1  

When you created the directories as richard the system assumed that you were the owner and set you as the owner, you can either change the ownership and permissions manualy

当您创建目录为richard时,系统假定您是所有者并将您设置为所有者,您可以手动更改所有权和权限

sudo chown richard:developers
sudo chmod 775

or
set the default permissions for creating files/folders (found this: http://wiki.slicehost.com/doku.php?id=setting_up_ubuntu_slice_with_django_postgresql_ledgersmb_and_openvpn)
or
use acl's (see: http://ubuntuforums.org/showpost.php?p=3718480&postcount=12) for details

或者设置创建文件/文件夹的默认权限(找到这个:http://wiki.slicehost.com/doku.php?id = setting_up_ubuntu_slice_with_django_postgresql_ledgersmb_and_openvpn)或使用acl(参见:http://ubuntuforums.org/showpost.php? p = 3718480&postcount = 12)了解详情

#3


0  

How did you change the permissions of /server? Do it recursively, if you didn't.

你是如何改变/ server的权限的?如果不这样做,那就递归一次。

Good luck!

#4


0  

you must have set a restrictive umask

你必须设置一个限制性的umask

edit ~/.bash_profile

and modify the umask setting for the specific user.

并修改特定用户的umask设置。

http://en.wikipedia.org/wiki/Umask