Linux shell程序一

设计一个Shell程序,在/$HONE/test目录下建立50个目录,即user1~user50,
并设置每个目录的权限,其中其他用户的权限为:读;文件所有者的权限为:
读、写、执行;文件所有者所在组的权限为:读、执行。
mkdir -p /home/www/
chmod chhh

 

编写shell程序,添加一个新组为class1,然后添加属于这个组的20个用户,
用户名的形式为stdxx,其中xx从01到20。

提示:
groupadd class1 添加用户组
useradd $username –G class1  把用户添加到class1用户组
chgrp -R class1 /home/$username  修改用户宿主目录(及子目录)属于class1用户组
#!/bin/bash

groupadd class1

for i in `cat 1.c`
do
        useradd "std${i}" -G class1
        chgrp -R class1 "/home/std${i}"
done

 

posted on 2016-12-01 10:34  寒魔影  阅读(274)  评论(0编辑  收藏  举报

导航