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

What is an efficient and simple method for server login configuration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "what is an efficient and simple server login configuration method". In daily operation, I believe that many people have doubts about what is an efficient and simple server login configuration method. I have consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the doubts about "what is an efficient and simple server login configuration method". Next, please follow the editor to study!

Login server: ssh

Replace the following IP address with the public network address of your CVM and provide a password to log in. But remember an IP address, which is an inhumane operation, what if you have multiple servers? At this point, ssh-config came in handy.

Quick login for $ssh root@172.16.3.2: ssh-config

Configure ssh-config on the local client environment (PC) and alias the personal server to make it easier to log in to the cloud server. Here is the configuration file about ssh-config

/ etc/ssh/ssh_config~/.ssh/config

The following is the configuration of shanyue and shuifeng for quick login to Shanyue server

# modify ssh configuration file ~ / .ssh/config

Host shanyue

HostName 59.110.216.155

User root

Host shuifeng

HostName

User root

After the configuration is successful, the ssh host name can be directly used, isn't it convenient?

$ssh shanyue

The authenticity of host '59.110.216.155 (59.110.216.155)' can't be established.

ECDSA key fingerprint is SHA256:WXULVpZcrX6kENrR5GH0mqRi49Djj22UXba0dRXCVKo.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added '59.110.216.155' (ECDSA) to the list of known hosts.

Welcome to Alibaba Cloud Elastic Compute Service!

[root@shanyue ~] #

[root@shanyue ~] #

[root@shanyue ~] #

Secret-free login: public-key and ssh-copy-id

But with only an alias, it is troublesome enough to enter a password every time. "how to achieve secret-free login to a remote server?"

Two files: ssh/id_rsa.pub in the local environment and ssh/authorized_keys in the remote server: copy and paste the contents of the local file to the remote server

"summed up in one sentence, put your public key on the remote server. "

To put it simply, it is the operation of Ctrl-C and Ctrl-V, but it is relatively trivial to implement. More importantly, there is a threshold for newcomers: the use of vim.

At this time, a command line tool to solve productivity arises at the historic moment: ssh-copy-id

# operate in the local environment

# prompt you to enter your password. After success, you can log in directly to ssh without a password.

$ssh-copy-id shanyue

# login is successful, no password required

$ssh shanyue disable password login

In order to ensure the security of the server, password login is prohibited here. Modify the sshd configuration file of the CVM: / etc/ssh/sshd_config. Where PasswordAuthentication is set to no to disable password login.

# Editing / etc/ssh/sshd_config on the server side

# disable password login

Host *

PasswordAuthentication no stay connected

At this time, everything seemed to be going well and satisfied, so Shan Yue went to pick up a glass of water to drink. However, when I came back, I found that the ssh connection was broken during the timeout, and because hang lived. How can you stand this?

In the client's ssh-config configuration file, add two lines of configuration.

Host *

ServerAliveInterval 60 at this point, on the "what is an efficient and simple server login configuration method" is over, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report