BBS水木清华站∶精华区

发信人: hellguard (小四★笑看风云), 信区: Linux        
标  题: Re: 怎样限制一个用户可以启动的进程数? (转载) 
发信站: BBS 水木清华站 (Tue Sep 28 13:27:18 1999) 
 
edit /etc/pam.d/login 
 
#%PAM-1.0 
auth       required     /lib/security/pam_securetty.so 
auth       required     /lib/security/pam_pwdb.so shadow nullok 
auth       required     /lib/security/pam_nologin.so 
account    required     /lib/security/pam_pwdb.so 
password   required     /lib/security/pam_cracklib.so 
password   required     /lib/security/pam_pwdb.so shadow nullok use_authtok 
session    required     /lib/security/pam_pwdb.so 
session    required     /lib/security/pam_limits.so 
 
you have to add the last two lines 
 
edit /etc/security/limits.conf 
 
# /etc/security/limits.conf 

#Each line describes a limit for a user in the form: 

#<domain>        <type>  <item>  <value> 

#Where: 
#<domain> can be: 
#        - an user name 
#        - a group name, with @group syntax 
#        - the wildcard *, for default entry 

#<type> can have the two values: 
#        - "soft" for enforcing the soft limits 
#        - "hard" for enforcing hard limits 

#<item> can be one of the following: 
#        - core - limits the core file size (KB) 
#        - data - max data size (KB) 
#        - fsize - maximum filesize (KB) 
#        - memlock - max locked-in-memory address space (KB) 
#        - nofile - max number of open files 
#        - rss - max resident set size (KB) 
#        - stack - max stack size (KB) 
#        - cpu - max CPU time (MIN) 
#        - nproc - max number of processes 
#        - as - address space limit 
#        - maxlogins - max number of logins for this user 

#<domain>      <type>  <item>         <value> 

 
#*               soft    core            0 
#*               hard    rss             10000 
#@student        hard    nproc           20 
#@faculty        soft    nproc           20 
#@faculty        hard    nproc           50 
#ftp             hard    nproc           0 
#@student        -       maxlogins       4 
 
 
    as you can see you can limit the number of process and much more 
    like cpu, stack ... 
 
 
-- 
 
            也许有一天,他再从海上蓬蓬的雨点中升起, 
            飞向西来,再形成一道江流,再冲倒两旁的石壁, 
            再来寻夹岸的桃花。然而,我不敢说来生,也不敢信来生...... 
 
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 203.207.226.124] 

BBS水木清华站∶精华区