liubei,guanyu,zhangfei三个用户共同属于shuguo组,/app/house属主为liubei,属组为shuguo,每个人在/app/house都有单独的目录liubei_room,guanyu_room,zhangfei_room,而且相互间不可以访问,包括其他人。
/app/house其他权限为零
useradd liubei
useradd guanyu
useradd zhangfei
mkdir /app/house
chown liubei /app/house(chown只有root用户可以执行)
(useradd caocao)
chmod o-rx /app/househouse(chmod:只有文件所有人和root执行)
groupadd shuguo
usermod -G shuguo liubei
gpasswd -a guanyu shuguo
groupmems -g shuguo -a zhangfei
(id liubei;id guanyu;id zhangfei)
(查询shuguo组里面的用户列表:groupmems -g shuguo -l)
chgrp shuguo /app/house
mkdir /app/house/liubei_room
chmod o=--- /app/house/liubei_room
su - liubei
chmod 770 /app/house(让guanyu和liubei创建自己的目录:-wx)
su - guanyu
mkdir /app/house/guanyu_room(进到house目录下创建)
su - zhangfei
mkdir /app/house/zhangfei_room(进到house目录下创建)
chmod 770 /app/house/zhangfei_room
su - guanyu
chmod 770 /app/house/guanyu_room