linux limits.conf配置

來源:互聯網
上載者:User

標籤:設定檔   使用者名稱   linux   萬用字元   最大值   

limits.conf 檔案實際是 Linux PAM(插入式認證模組,Pluggable Authentication Modules)中 pam_limits.so 的設定檔,而且只針對於單個會話。

  limits.conf的格式如下:

  username|@groupname type resource limit

  username|@groupname:設定需要被限制的使用者名稱,組名前面加@和使用者名稱區別。也可以用萬用字元*來做所有使用者的限制。

  type:有 soft,hard 和 -,soft 指的是當前系統生效的設定值。hard 表明系統中所能設定的最大值。soft 的限制不能比har 限制高。用 - 就表明同時設定了 soft 和 hard 的值。

  resource:

  core - 限制核心檔案的大小

  date - 最大資料大小

  fsize - 最大檔案大小

  memlock - 最大鎖定記憶體位址空間

  nofile - 開啟檔案的最大數目

  rss - 最大持久設定大小

  stack - 最大棧大小

  cpu - 以分鐘為單位的最多 CPU 時間

  noproc - 進程的最大數目

  as - 地址空間限制

  maxlogins - 此使用者允許登入的最大數目

  

 

例如:修改檔案描述符大小(65536)

vi  /etc/security/limits.conf

 

*                               soft    nofile  65536

*                               hard    nofile  65536


使這些限制生效 


(1)確定檔案/etc/pam.d/login 和/etc/pam.d/sshd包含如下行: 

session required pam_limits.so


(2)vi /etc/security/limits.d/90-nproc.conf  

修改注釋內容:

*          soft    nproc     unlimited

 

(3)然後使用者重新登陸一下即可生效。 

在bash下可以使用ulimit -a 參看是否已經修改


linux limits.conf配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.