sudo: ulimit: command not found

来源:互联网 发布:航天远景 无人机软件 编辑:程序博客网 时间:2024/05/29 18:34
10 down vote

ulimit is a shell builtin like cd, not a separate program.sudo looks for a binary to run, but there is noulimit binary, which is why you get the error message. You need to run it in a shell.

However, while you do need to be root to raise the limit to 65535, you probably don’t want to run your program as root. So after you raise the limit you should switch back to the current user.

To do this, run:

sudo sh -c "ulimit -n 65535 && exec su $LOGNAME"

and you will get a new shell, without root privileges, but with the raised limit. Theexec causes the new shell to replace the process withsudo privileges, so after you exit that shell, you won’t accidentally end up as root again.

原创粉丝点击