ssh no password

To enable passwordless SSH access to a remote machine, you can manually copy your public SSH key into the ~/.ssh/authorized_keys file for the user you want to connect as.

Steps

  1. Generate an SSH key (if you haven't already):
    ssh-keygen
    This will create two files in ~/.ssh/:
    - id_rsa (private key)
    - id_rsa.pub (public key)
  2. Copy your public key to the remote machine:

    You can do this manually using the following command:

    cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
    Replace user with the remote username and host with the IP address or domain name of the server.
  3. Test the connection:
    ssh user@host
    If everything is set up correctly, you should connect without being prompted for a password.

Notes


edit this page