How to configure ssh for Linux Server
This article will explain in detail how to configure the ssh of the Linux server. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Ssh configuration
Through configuration files, we can manage ssh effectively
1. Close the connection in idle time
1) modify the configuration file "/ etc/ssh/sshd_config", set clientAliveInterval and clientAliveCountMax, and cancel the previous comments
[root@localhost wj] # gedit / etc/ssh/sshd_conf
ClientAliveInterval 10 / / timeout, 10s
ClientAliveCountMax 0 / / number of timeouts, times
[root@localhost wj] # service sshd restart / / restart the service
Stop sshd: [OK]
Starting sshd: [OK]
2) the test timed out. Do not do anything after logging in. The connection will be closed after 10 seconds.
[root@localhost wj] # ssh david@192.168.0.119
David@192.168.0.119's password:
Last login: Thu Aug 16 08:22:25 2018 from 192.168.0.119
Already login
[david@localhost] $Connection to 192.168.0.119 closed by remote host.
Connection to 192.168.0.119 closed.
[root@localhost wj] #
2. Enter the password timed out and close the connection
1) modify the configuration file "/ etc/ssh/sshd_config" and set the parameter "LoginGraceTime"
[root@localhost wj] # gedit / etc/ssh/sshd_config
LoginGraceTime 10s / / here the default is 2m, which represents 2 minutes. Set to 10s and uncomment
[root@localhost wj] # service sshd restart / / restart the service
Stop sshd: [OK]
Starting sshd: [OK]
2) Test: if you do not enter a password when you log in, the connection will be disconnected automatically
[root@localhost wj] # ssh david@192.168.0.119
David@192.168.0.119's password:
Connection closed by UNKNOWN
I have made a platform for Linux learning. At present, it comes out one by one, which you can refer to and use.
Link: https: / / pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk
This is the end of the ssh configuration of the Linux server. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.