bash: ulimit: open files: cannot modify limit: Operation not permitted

# ulimit -n 10000000
-bash: ulimit: open files: cannot modify limit: Operation not permitted

遇到這個錯,要加大 /etc/sysctl.conf 中的兩個值

fs.nr_open,進程級別, nr_open 總是應該小於等於 fs.file-max。
fs.file-max,系統級別

馬上生效:

echo ‘10000000’ > /proc/sys/fs/file-max
echo ‘10000000’ > /proc/sys/fs/nr_open
# 同時寫入到sysctl.conf中即可在機器重啓時生效。

注意同時修改 /etc/security/limits.conf,如果有用到。
如果hard nofile 大於file-max會導致新的ssh連接無法登錄。

  • soft nofile 1048576
  • hard nofile 1048576
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章