CentOS7调整limit限制

## 这是修改全局下
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
posted @ 2023-05-24 15:46  Chuyio  阅读(768)  评论(0编辑  收藏  举报