Skolelinux创建文件夹

Skolelinux创建文件夹以这一脚本管理者可以在每个用户主目录内创建文件夹并设置访问许可和权限

在下面的例子中显示作为 group=teachers 和 permissions=2770 的一个用户可以上交一份作业保存在文件夹 "assignments" ,那里教师具有写权限能够批改它

home_path="/skole/tjener/home0";shared_folder="assignments";permissions="2770";created_dir=0;for home in $(ls $home_path);do. if [ ! -d "$home_path/$home/$shared_folder" ]; then. mkdir $home_path/$home/$shared_folderchmod $permissions $home_path/$home/$shared_folder. #set the right owner and group#"username" = "group name" = "folder name"user=$homegroup=teacherschown $user:$group $home_path/$home/$shared_folder((created_dir+=1))else. echo -e "the folder $home_path/$home/$shared_folder already exists. ". fidoneecho "$created_dir folders has been created"

以上内容由大学时代综合整理自互联网,实际情况请以官方资料为准。

相关