从 .bash_profile 中删除 ulimit 条目

  1. 从 $HOME/.bash_profile 文件中删除 ulimit 条目(如果存在)。
    例如,从 .bash_profile 中删除设置为 ulimit 的行,如下所示:
ulimit -u 4096
  1. 在/etc/profile中添加相关条目,如下图:
if [ $USER = "oracle" ]; then
ulimit -u 4096
......
fi

问题

以 oracle 用户身份登录时,控制台上显示以下消息。

-bash: ulimit: max user processes: cannot modify limit:operation not permitted.
ulimit: max user processes: cannot modify limit:operation not permitted
on it road .com

解决方案

ulimit 选项 '-u ' 这意味着通过在 $HOME/.bash_profile 中添加以下行直接将最大用户进程数设置为更大的一个。

$ ulimit -u 4096
$ ulimit -u 
4096

但最初在/etc/profile 中为oracle 用户设置了最大用户进程数为1024.

if [ $USER = "oracle" ]; then
ulimit -u 1024
......
fi

当在/etc/profile 中设置了ulimit '-u' 选项时,不能通过在$HOME/.bash_profile 中添加'ulimit -u 4096' 行直接将其更改为更大的选项。

日期:2020-09-17 00:12:44 来源:oir作者:oir