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

MAC SSH key login

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

MAC SSH Key Login:

General mac if you want to log in through ssh key, conventional practice, generate your own key pair, the advantage of doing so is that you only keep the private key, the public key can be placed on any server, if you accept the private key given by others, only one can be saved, if there are multiple private keys to you, it is not convenient to manage, so it is recommended to generate your own key pair, public key upload server, the specific steps are as follows:

1. Generate a key pair through the mac terminal, ssh-keygen -t rsa -C"jurchens1987@gmail.com," and upload the public key to the server corresponding to the user's.ssh/authorized_keys.

2. Locally log in to the server via ssh username@servername

3. If you want to log in quickly, you can log in by alias

Create a new config file in the mac .ssh/directory. vi edit this file as follows:

Host mm58 #Set aliases, such as mm58

HostName 192.168.x.x #Domain or ip

Port 22 #Default port, can be modified according to actual situation

User ssl #Log in user, such as ssl

The requested URL/Users/haiwai02/.ssh/id_rsa #was not found on this server.

After saving and exiting, you can log in directly through the following alias

ssh mm58 #can be used to log in key

In addition, in general, we need to log in to multiple servers, you can continue to add them in the configuration file, the private key does not need to be added, you can share one, as follows, we add a foo account:

Host mm57

HostName X.X.X.X

Port 22

User foo

Host mm58 #Set aliases, such as mm58

HostName 192.168.x.x #Domain or ip

Port 22 #Default port, can be modified according to actual situation

User ssl #Log in user, such as ssl

The requested URL/Users/haiwai02/.ssh/id_rsa #was not found on this server.

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