## 这是修改全局下
cat >>/etc/security/limits.conf<<EOF
#### memlock(max locked memory)
#### cpu(cpu time)
* soft memlock unlimited
* hard memlock unlimited
* soft cpu unlimited
* hard cpu unlimited
### open files(nproc\nofile)
* soft nproc 102431
* hard nproc 102431
* soft nofile 102431
* hard nofile 102431
####
* soft stack 65536
* hard stack 65536
####
* soft core unlimited
* hard core unlimited
EOF
## 调整可以 运行的最大并发进程数
echo " * - nproc unlimited" >/etc/security/limits.d/20-nproc.conf
echo "session required pam_limits.so" >>/etc/pam.d/login
## 调整sshd服务,当我们用ssh客户端工具连接后,才会生效
echo "UsePAM yes" >>/etc/ssh/sshd_config
echo "UseLogin yes" >>/etc/ssh/sshd_config
systemctl restart sshd
标签:sshd,限制,limits,echo,CentOS7,etc,limit,ssh,security
From: https://www.cnblogs.com/chuyiwang/p/17428554.html