zoukankan      html  css  js  c++  java
  • 登录普通用户会报错-bash: ulimit: open files: cannot modify limit: Operation not permitted

    登录普通用户会报错-bash: ulimit: open files: cannot modify limit: Operation not permitted

    root@localhost local]# ssh chaofeng@192.168.50.131
    chaofeng@192.168.50.131's password: 
    Last login: Fri Jul  3 14:01:33 2020 from 192.168.50.132
    -bash: ulimit: open files: cannot modify limit: Operation not permitted
    

    这个问题刷新了一些错误的认识,因为曾经只用root用户设置这些系统优化参数,从来不考虑普通用户。已经手里面运维权限都挺大哈哈。不过今天有人问起来了,我还是研究了一下,发现一个问题,就是。
    在/etc/security/limits.conf文件里面设置的soft和hard的描述符的数值,这个文件只能root用户编辑,数值最大可以设置为1024*1024,当然根据情况设置的值肯定是一个比较适合的值。比如这里咱们就设置为65535,如下所示:

    *	hard	nofile	65535
    *	soft	nproc	65535
    

    那么此时对于普通用户而言,普通用户在使用ulimit -n xxx,设置描述符大小的时候,这个xxx的大小不能超过/etc/security/limits.conf的大小,否则就会报错。报错的信息就是标题上面的那些。
    如果普通用户使用ulimit报了上面的错误信息,说明普通用户在设置ulimit的大小超过了/etc/security/limits.conf的大小。至于为什么一登录系统时就报错,那就是因为在/etc/bash_profile,/etc/bashrc、/.bashrc、/.bash_profile等用户登录的脚本里面使用了ulimit -n设置描述符的命令,所以才会报这样的错误。
    所以解决方法就两种:如果你看懂了上面说的你就立马知道怎么解决,不懂的看下面:
    1、修改的/etc/security/limits.conf的值为最大值1024*1024
    2、找到普通用户登录执行的脚本,把ulimit -n xxx命令去掉即可。

  • 相关阅读:
    Maximum Flow Exhaustion of Paths Algorithm
    ubuntu下安装java环境
    visualbox使用(二)
    vxworks一个超级奇怪的错误(parse error before `char')
    February 4th, 2018 Week 6th Sunday
    February 3rd, 2018 Week 5th Saturday
    February 2nd, 2018 Week 5th Friday
    February 1st, 2018 Week 5th Thursday
    January 31st, 2018 Week 05th Wednesday
    January 30th, 2018 Week 05th Tuesday
  • 原文地址:https://www.cnblogs.com/FengGeBlog/p/13230690.html
Copyright © 2011-2022 走看看