linux下创建只有某个用户组可用的文件夹

su root

mkdir testdir

ll

 drwxr-xr-x  2 root   root       4096  7月 31 23:51 testdir/

chmod g+w,o-rx testdir——————————修改权限,拥有者、群组有rwx权限,其他没有任何权限

ll

drwxrwx---  2 root   root       4096  7月 31 23:51 testdir/

groupadd testgroup—————————创建群组testgroup

useradd -G testgroup testuser——————添加用户testuser到testgroup中

chgrp testgroup testdir/————————修改testgroup所属群组

 

useradd user2

su user2

cd testdir————————无权限

su testuser

cd testdir————————OK

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted on 2013-08-01 16:32  agiletiger  阅读(418)  评论(0编辑  收藏  举报