由于pty
是有限的,我想修改/proc/sys/kernel/pty/max
。 max中的原始值是4096,现在我想修改为10000。
[root@home pty]# pwd /proc/sys/kernel/pty [root@home pty]# ls -lh total 0 -rw-r--r-- 1 root root 0 Aug 13 11:24 max -r--r--r-- 1 root root 0 Aug 13 11:24 nr vim max
我使用root直接编辑最大文件,但是失败了。 我用:w!
在vim中,但后来我看到下面的图片:
所以我试图先chmod
max,但是也失败了:
[root@home pty]# chmod 666 max chmod: changing permissions of `max': Operation not permitted [root@home pty]# whoami root
那么,如何更改/proc/sys/kernel/pty/max
呢?
@乔恩林:
它也失败了使用sysctl
命令:
[root@home kernel]# sysctl -a | less | grep pty kernel.pty.nr = 2 kernel.pty.max = 4096 [root@home kernel]# sysctl kernel.pty.max=10000 error: "Operation not permitted" setting key "kernel.pty.max" [root@home kernel]# sysctl -p kernel.pty.max 10000 error: unable to open preload file "kernel.pty.max" [root@home kernel]# sysctl -p kernel.pty.max = 10000 error: unable to open preload file "kernel.pty.max"
@AlanCurry:
它也失败了使用回声:
[root@home pty]# cat max 4096 [root@home pty]# echo 10000 > max bash: echo: write error: Operation not permitted [root@home pty]# echo 10000 >> max bash: echo: write error: Operation not permitted [root@home pty]# cat max 4096
如果你想改变你可以拥有的最大伪terminal的数量,不要编辑proc文件。 您应该对/etc/sysctl.conf
进行更改,然后重新运行sysctl -p
以在运行时更改内核参数。 具体更改(或添加)具有以下内容的行:
kernel.pty.max = <max>
将<max>
更改为您想要的数字。
刚在我的环境中遇到同样的问题。
显然,OpenVZ在主机级别上控制这些variables,也就是说,如果你想改变一些设置,你需要在主机上改变它,并且作为一个效果,它将被应用到在物理服务器上运行的所有虚拟机。