astar 发表于 2025-11-14 10:38:14

【已解答】宝塔重启后,在宝塔的linux 终端,ulimit 只有1

为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:11.2
系统版本:cnetos7
问题描述:宝塔重启后,在宝塔的linux 终端,ulimit -n 只有1024
相关截图(日志、错误):
cat /etc/security/limits.conf进行了修改
# End of file
* soft nofile 100001
* hard nofile 100002
root soft nofile 100101
root hard nofile 100102
* soft nofile 100001
* hard nofile 100002
root soft nofile 100101
root hard nofile 100102
* soft memlock unlimited
* hard memlock unlimited

新买的服务器,安装宝塔后运行 ulimit -n是 100001 ,一旦重启服务器,重新在宝塔里 输入 ulimit -n 变成 1024 ,现在临时处理办法是重启服务器后,在   /etc/init.d/bt加入ulimit -n 100001,每次重启都要去加上 这句,不然不生效
怎么一上传图片 就说有违禁词

运维技术阿闯 发表于 2025-11-14 12:12:23

您好,您可以设置下永久配置
配置 /etc/security/limits.conf(用户级限制)
在文件末尾添加以下内容(* 表示对所有用户生效,也可指定具体用户如 www)
* soft nofile 100001
* hard nofile 100001

soft nofile:软限制(用户可临时调整,但不超过硬限制)。
hard nofile:硬限制(系统强制的最大限制)。

astar 发表于 2025-11-14 13:15:14

运维技术阿闯 发表于 2025-11-14 12:12
您好,您可以设置下永久配置
配置 /etc/security/limits.conf(用户级限制)
在文件末尾添加以下内容(* 表 ...

在 配置 /etc/security/limits.conf 做了修改,上面有修改完成后的内容 ,在 自己的ssh 工具里运行 ulimit -n 是有效果的,但登入 宝塔后,用宝塔的 ssh 输入ulimit -n 就是1024 ,重启服务器后,依然在宝塔的 ssh 里是 1024,自己的ssh工具是设置的值,明天也联系了腾讯云的客服,在他们自己做的镜像也是一样的,只有在宝塔的 ssh里ulimit 不生效,导致运行时总是出现文件连接数不够,在宝塔 V9.X的版本中不会出现,就 V11 的版本中是这样

astar 发表于 2025-11-14 13:20:07

运维技术阿闯 发表于 2025-11-14 12:12
您好,您可以设置下永久配置
配置 /etc/security/limits.conf(用户级限制)
在文件末尾添加以下内容(* 表 ...

怎么回复没了?

astar 发表于 2025-11-14 15:45:13

astar 发表于 2025-11-14 13:15
在 配置 /etc/security/limits.conf 做了修改,上面有修改完成后的内容 ,在 自己的ssh 工具里运行 ulimi ...

早设置过了
# End of file
* soft nofile 100001
* hard nofile 100002
root soft nofile 100101
root hard nofile 100102
* soft nofile 100001
* hard nofile 100002
root soft nofile 100101
root hard nofile 100102
* soft memlock unlimited
* hard memlock unlimited

在 自己的终端ssh 里生效,在宝塔的终端 ssh 里只有 1024

php 等服务是基于宝塔搭建的,所以用户一多 就报 文件连接不够

现在是 只能 手动的在 /etc/init.d/bt加入ulimit -n 100001


但每次重启后 加的这个就被还原 了
页: [1]
查看完整版本: 【已解答】宝塔重启后,在宝塔的linux 终端,ulimit 只有1