百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> linux提示could not open session错误解决办法
分享文章到:

linux提示could not open session错误解决办法

发布时间:01/15 来源: 浏览: 关键词:
session是服务器的一个环境变量了,我们经常会利用 session来做安全验证了,下文我们就一起来看一篇linux提示could not open session错误解决办法。

一、问题

一台现网主机在root用户登录时报错“ could not open session ” ,在这之前由于oracle需要进行过ulimit参数的调整。如下:

#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
root              soft    nproc   unlimited
root              hard    nproc   unlimited
root              soft    nofile  unlimited
root              hard    nofile  unlimited
上面的配置咋一看没什么问题,而且理论上来说root用户的nproc和nofile是不受限制的,这里根本也无需加该设置。通过手动去配置发现nofile是无法设置成unlimited的。如下:

[root@361way ~]# ulimit -u unlimited
[root@361way ~]# ulimit -n unlimited
-bash: ulimit: open files: cannot modify limit: Operation not permitted
[root@361way ~]#

由上面可以发现max open file是无法设置成unlimited的,这样设置后,通过登录su到root就会提示"could not open session" 。修复方法就是将刚增加的四行或最后两行删除就行了。

在Http长连接200万尝试及调优篇中,也提到过 “在2.6.25内核之前有个宏定义,定义了这个值的最大值,为1024*1024,正好是100万,而在2.6.25内核及其之后,这个值是可以通过/proc/sys/fs/nr_open来设置。”,所以该值理论上最大也就200万左右。

二、扩展

其他情况下也可能会出现"could not open session" 报错的情况。如:

1、max open file值为负值;

2、/etc下部分目录被修改时,也会提示该报错。这里参见痞子阿飞的blog ,不过该问题我在测试时发现报错信息和原文提到的不同,如下:

[root@361way /]# su - amos
-bash: /etc/profile: Permission denied
-bash-4.1$ exit
logout
-bash: /etc/bash.bash_logout: Permission denied
[root@361way /]# chmod 755 etc/

总结得来讲就是权限不足了,其实许多情况在linux系统中就是权限问题了,我们今天碰到这个问题也是权限问题了。

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有15人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板