Linux security & performance tuning - others

本文关注于Linux系统的安全性和性能调整,包括检查存在的限制,如打开文件数和最大用户进程,并记录错误日志。针对sshd服务出现的资源不足问题,通过修改/etc/security/limits.conf和/etc/ssh/sshd_config等配置文件,增加最大文件描述符数量、最大用户进程数和最大会话数,以解决'no more sessions'错误。同时,注意到特定用户并发登录的限制可以通过编辑/etc/security/limits.d/90-nproc.conf来调整。

1. check existing limits : 

[root@test3 security]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63699
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024

pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 63699
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

 

2. Errors and logs : 

1) log location  : var/log/secure

2) Error 1 : 

May  6 13:16:35 test3 sshd[9800]: subsystem request for sftp
May  6 13:16:35 test3 sshd[9800]: error: do_exec_no_pty: fork: Resource temporarily unavailable
May  6 13:16:35 test3 sshd[9800]: subsystem request for sftp failed, subsystem not found

file changed : /etc/security/limits.conf
 -- changed open files to  4096 from 1024; 
 -- changed max user processes(hard & soft)  to  128376 from  63699
 -- user maxlogins added : 1000

3)Error 2 : no more sessions

 file changed : /etc/ssh/sshd_config
--MaxSessions 10240  from 1000
--MaxStartups 10240  from 1000

much less "no more sessions" error now but still some 

4) file changed : /etc/security/limits.conf 
-- change maxlogins from 1000 to 2000  (this may not help )


5) file changed : /etc/security/limits.d/90-nproc.conf   ( this control the max open sessions/concurrent logins for specific user : stormReportsUat  , help "no more sessions" error
-- added stormRepUser   soft    nproc     10240

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值