简体   繁体   English

在 Amazon EC2 实例中设置 SSH 超时 - CentOS 7

[英]Set SSH timeout in Amazon EC2 instance - CentOS 7

I'm using CentOS 7 and trying to set time-out to 15 sec我正在使用 CentOS 7 并尝试将超时设置为 15 秒

in /etc/ssh/sshd_config set在 /etc/ssh/sshd_config 设置

ClientAliveInterval 15
TCPKeepAlive no
ClientAliveCountMax 1

restarted sshd service but SSH session is active after 15 sec重新启动 sshd 服务,但 15 秒后 SSH 会话处于活动状态

added also还加了

TMOUT=15 to /etc/profile

but still nothing但还是什么都没有

After lot of googling found it out:经过大量的谷歌搜索发现:

/etc/ssh/sshd_config has no any effect, it's meant for when the connection between the ssh client and the ssh server become unresponsive /etc/ssh/sshd_config 没有任何影响,它的意思是当 ssh 客户端和 ssh 服务器之间的连接变得无响应时

cat /etc/profile.d/ssh-timeout.sh
export TMOUT=15
readonly TMOUT

and reboot并重新启动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM