问题描述:
登录系统报错,-bash: ulimit: open files: cannot modify limit: Operation not permitted
Last login: Thu Aug 23 14:42:27 2012 from 10.6.90.41
-bash: ulimit: open files: cannot modify limit: Operation not permitted
-bash: ulimit: open files: cannot modify limit: Operation not permitted
实际上是执行ulimit命令时,出现问题
-bash-3.2$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1064960
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16384
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
-bash-3.2$
-bash-3.2$ ulimit -u 16384 -n 65536
-bash: ulimit: open files: cannot modify limit: Operation not permitted
-bash-3.2$
相关配置均没有问题
-bash-3.2$ cat /etc/security/limits.conf
#add by wj for rac
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
-bash-3.2$ cat /etc/pam.d/login
#add by wj for rac
session required pam_limits.so
-bash-3.2$
-bash-3.2$
-bash-3.2$ cat /etc/profile
#add by wj for rac
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
原因分析:
因为问题发生在openssh升级之后,且只有ssh登录才发生此问题,因此基本怀疑和ssh有关
解决办法:
问题终于解决,确实是ssh版本的问题
vi /etc/ssh/sshd_config
把 UseLogin 设置为 yes,
#UseLogin no
UseLogin ye
重启ssh服务
service sshd restart
UseLogin具体的含义如下,看过后也不是很明白 UseLogin 是否在交互式会话的登录过程中使用 login(1) 。默认值是"no"。 如果开启此指令,那么 X11Forwarding 将会被禁止,因为 login(1) 不知道如何处理 xauth(1) cookies 。 需要注意的是,login(1) 是禁止用于远程执行命令的。 如果指定了 UsePrivilegeSeparation ,那么它将在认证完成后被禁用。