Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure ssh for Linux Server

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report