2008年1月11日 星期五

用戶建立與預設家目錄中的檔案

家目錄中預設檔案的用途,以umask為例,一般我們預設umask的值為0022,亦即我們所建立的目錄權限為755,而檔案權限為644,當我們要讓相同group內的使用者可以共享檔案(g=rw)時,便可以如此做:


echo “umask 0002” >> /etc/skel/.bashrc


利用for loop快速建立使用者

實作範例:A system with user Joshua and alex in the sales group; dax and byran in the hr group; zak and ed in the web group, and manager in the sales, hr, and web groups.

#for group in sales hr web

>do

>groupadd $group

>done


#for user in Joshua alex dax byran zak ed manager

>do

>useradd $user

>done


#usermod –G sales,hr,web manager

沒有留言: