Previously, I used to connect to the server using a terminal provided by Mac. The general steps are as follows:
1. Ssh-P 10000 huangwei@1.1.1.1
2. Enter the password
However, it is quite troublesome to enter a password every time. The SSH-copy-ID tool is more convenient to log on.
First, generate the public key and private key.
Ssh-keygen-T RSA
After entering the information as prompted ~ /. Generate the id_rsa and id_rsa.pub files under the SSH directory.
Then, start to Establish a trust relationship with the server:
Ssh-copy-ID-P 10000 huangwei@1.1.1.1
The SSH-copy-id command cannot be used to set the service port with-P. By default, it only connects to port 22.
But you can do it with the following method:
Ssh-copy-ID "-P 10000 huangwei@1.1.1.1"
Enter the password again, and you will not need to enter the password again later.
Finally, you can use alias to rename this sentence for convenience.