[MacOS] SSH setting alias + password-free login

set alias

First, enter the ssh config file

vim ~/.ssh/config

Press I to write

Host my_name
User zmq
HostName 1xx.xx.xx.xxx
Port 22

Enter: x to save and exit, and the alias is set successfully. can directly

ssh my_name

carry out testing.

Password-free login

The method of password-free login is 1. Generate public and private keys, 2. Pass the public key to the server

First generate public and private keys locally

ssh-keygen

Just keep pressing Enter, and then confirm whether the public and private keys are generated successfully:

ls ~/.ssh

insert image description here
Generated successfully.

Upload the public key to the server

ssh-copy-id -i ~/.ssh/id_rsa.pub my_name

Then test directly:

ssh my_name

complete.

Guess you like

Origin blog.csdn.net/euzmin/article/details/128512827