In a project group, a member of a group wants to share a file for co-development, and we build lucy,lewis,mike,peter four users so that they are all in the group workgroup:
# #新建一个名为workgroup的用户组
Groupadd Workgroup
# #新建上面四个用户, and put it directly into the workgroup group
Useradd-g Workgroup Lucy # #将用户lucy放入组workgroup中, if you don't have this user, create it
passwd Lucy # #为lucy用户设置密码
Useradd-g Workgroup Lewis # #将用户lewis放入组workgroup中, if you don't have this user, create it
passwd Lewis # #为用户lewis设置密码
Two other users we do the same.
Below we will create a new work folder under the/home folder as the working directory for this group
Cd/home # #切换到home文件夹
mkdir Work # #新建work文件夹
Anyone can access this new directory at this point, but only the root user has write access to the directory, so we have to let users in the workgroup have write access to it, while others cannot view the directory.
CHGRP Workgroup work/# #把work目录的所有权交给workgroup组
chmod g+rwx work/# #增加workgroup组对于work文件夹的读, write, execute permissions
chmod o-rwx work/# #撤销其它用户对于work文件夹的读, write, execute permissions
Next, we'll give the work catalogue to a team leader, Lewis.
Chown Lewis work/# #将work目录的所有者更改为lewis用户
At this point, all members of the workgroup can do nothing with the contents of the work directory, and other users do not have any permissions
This article is from "Aixinjueluo Radium Blog" blog, please be sure to keep this source http://hackcrack.blog.51cto.com/6169318/1575483
Share files in Linux and your team