刘明野

frp 报错 accept4: too many open files

accept4: too many open files报错linux问题排除 https://sword.studio/141.html

Ubuntu 永久修改 ulimit -n https://learnku.com/articles/21457

【经验】使用FRP搭建内网穿透服务 https://blog.csdn.net/hangvane123/article/details/100600825

设置文件最大打开数

# 系统
echo 'fs.file-max = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# 用户
sudo tee -a /etc/security/limits.conf << EOF
*               hard    nofile          65535
*               soft    nofile          65535
root            hard    nofile          65535
root            soft    nofile          65535
EOF

# Systemd
sudo sed -i '/DefaultLimitNOFILE/c DefaultLimitNOFILE=65535' /etc/systemd/*.conf
sudo systemctl daemon-reexec

验证

# 打开新的终端
# ssh remote_user@host

# 查看系统限制
cat /proc/sys/fs/file-max

# 查看用户硬限制
ulimit -Hn

# 查看用户软限制
ulimit -Sn

# 查看某进程的限制
cat /proc/PID/limits # 将 PID 替换为具体的进程 ID

# 查看其他用户限制
su - www -c 'ulimit -aHS' -s '/bin/bash'
本文为作者刘明野发布,未经允许禁止转载!
6138
1
2
发表留言

    1
    3年前

    1 可以的

友情链接