在 Debian 里,ulimit 的设置重启后是否还在,取决于你是怎么设置的,分几种情况说清楚:
ulimit -n 65535
✅ 重启 → ❌ 不在
echo "ulimit -n 65535" >> ~/.bashrc
✅ 重启 → ✅ 在(仅限该用户登录)
* soft nofile 65535
* hard nofile 65535
✅ 重启 → ✅ 在(用户进程)
⚠️ 注意:
UsePAM yes(sshd 等)pam_limits.so如果你说的是服务程序(如 nginx、mysql、java):
[Service]
LimitNOFILE=65535
或在 /etc/systemd/system/xxx.service.d/limits.conf
✅ 重启 → ✅ 在(服务)
sysctl -w fs.file-max=100000
写入 /etc/sysctl.conf 后:
✅ 重启 → ✅ 在
ulimit 本身是“进程级”的,不持久;要重启后还在,必须写配置文件或 systemd 配置。
如果你能告诉我:
我可以直接给你准确可用的 Debian 配置方案。