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


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

相关内容

    暂无相关文章