Contents

How to Connect via SSH without Typing Passwords

Contents

To connect to a remote server using SSH without entering a password every time, you can set up SSH keys authentication. Here’s how you can do it:

Generate an SSH key pair on your local machine using the following command:

ssh-keygen -t rsa

When prompted for a passphrase, you can leave it blank or enter a passphrase to secure your key.

Copy the public key to the remote server using the following command:

ssh-copy-id user@remote-server

Replace “user” with your username and “remote-server” with the hostname or IP address of the remote server.

After entering your password, your public key will be added to the remote server’s authorized keys list.

Now you can log in to the remote server using SSH without entering a password each time.

Note: If the ssh-copy-id command is not available on your local machine, you can copy the contents of your public key manually to the remote server’s authorized_keys file. You can find your public key in the ~/.ssh/id_rsa.pub file on your local machine.