在 Debian(以及其他 Linux 发行版)里,修改 ulimit 通常不需要重启系统,但是否“立即生效”取决于你修改的是哪一层。
ulimit -n 65535
✅ 立即生效
❌ 只对这个 shell 及其子进程有效
❌ 退出 shell 后失效
/etc/security/limits.conf)* soft nofile 65535
* hard nofile 65535
修改后:
/etc/systemd/system/xxx.service)[Service]
LimitNOFILE=65535
修改后:
systemctl daemon-reload
systemctl restart xxx
✅ 不需要重启系统
✅ 立即对新启动的服务生效
/etc/sysctl.conf)例如:
fs.file-max = 1000000
执行:
sysctl -p
✅ 立即生效
❌ 和 ulimit 不是一回事(这是内核级上限)
❌ “改了 limits.conf 服务还是没生效”
Limit*❌ “root 用户不生效”
Debian 修改 ulimit 不需要重启系统,但通常需要:重新登录用户 或 重启服务。
如果你能说具体场景(比如:MySQL / Nginx / 普通用户 / Docker),我可以给你最精确的配置方式。