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 login in the server

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

Share

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

This article to share with you is about how to configure ssh login in the server, Xiaobian feel quite practical, so share to everyone to learn, I hope you can have some harvest after reading this article, not much to say, follow Xiaobian to see it.

** Server login configuration **

Quick login: ssh-config

Configure ssh-config on local client environment (MAC) to make it easier to access Cloud Virtual Machine

/etc/ssh/ssh_config

~/.ssh/config

Here is the quick login configuration for my two servers

#Modify ssh configuration file ~/.ssh/config

Host serverA

HostName 192.168.1.101

# HostName *.*.*.* private network IP

User root

Host ServerB

HostName

User root

Copy code #after successful configuration directly ssh Host name can be

$ ssh serverA

Copy code password free login: public-key and ssh-copy-id

How do I log on to a remote server without privacy?

Two files: ~/.ssh/id_rsa.pub for local environment and ~/.ssh/authorized_keys for remote server

One action: copy and paste the contents of a local file to a remote server

Put your public key on a remote server.

If the file ~/.ssh/id_rsa.pub does not exist, it is generated using ssh keygen

Simply put, it is Ctrl-C and Ctrl-V operation, but the specific implementation is more trivial. More importantly, there is a threshold for newcomers: vim use

A command line tool for productivity is needed: ssh-copy-id

#Operating in a local environment

#will prompt you to enter the password, after success, you can directly ssh into

$ ssh-copy-id serverA

Copy Code Disable Password Login

Modify the ssh configuration file of the Cloud Virtual Machine: /etc/ssh/ssh_config. PasswordAuthentication is set to no to disable password login

#Disable password login

Host *

PasswordAuthentication no

Create a new SSH key

Use ssh-keygen to generate id_rsa and id_rsa.pub file pairs

#Create an ssh-key

# -t: dsa optional| ecdsa | ed25519 | rsa |rsa1, representing encryption method

# -C: Comments, generally write your own mailbox

$ ssh-keygen -t rsa -C "server"

#Generate id_rsa/id_rsa.pub: Pair private key and public key

$ ls ~/.ssh

authorized_keys config id_rsa id_rsa.pub known_hosts

The above is how to configure ssh login in the server. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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