【Ubuntu/Linux】Set up Ubuntu18.04 SSH without login

Step 1: The host generates public and private keys

  1. Open cmd as administrator
  2. Run "ssh-keygen -t rsa"
  3. There is no need to enter anything and just press Enter. If you encounter a choice, just select Y.
  4. As shown in the figure below, the generation is successful and the secret key path is under "C:\Users\username.ssh"
    Insert image description here

Step 2: Copy the "id_rsa.pub" file to the .ssh folder of the Linux login user, usually "home/username/.ssh"

Step 3: Execute "cat id_rsa.pub > authorized_keys" in the user.ssh directory of the remote terminal.

Note, if a key pair already exists locally, go to the remote folder to edit authorized_keys and add your own public key at the end.

Guess you like

Origin blog.csdn.net/qq_42071369/article/details/129709745