問題描述:
登入系統報錯,-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 ,那麼它將在認證完成後被禁用。