How to set up ssh public key password-less on FreeBSD

How to set up ssh public key password-less on FreeBSD

To set up password-less SSH (Secure Shell) access on a FreeBSD system, you can use public key authentication. This method allows you to log in to the system using an SSH key pair, without entering a password.

To set up public key authentication, you will need to:

  1. Generate an SSH key pair: If you don't already have an SSH key pair, you will need to generate one. You can do this by running the ssh-keygen command on your local machine.
refer ‮ual:ot‬tturi.com
ssh-keygen

This will generate a public and private key, and prompt you to enter a passphrase for the private key. You can leave the passphrase blank if you don't want to use one.

  1. Copy the public key to the server: Next, you will need to copy the public key to the FreeBSD server. You can do this using the ssh-copy-id command:
ssh-copy-id username@server

Replace username with your username on the server, and server with the hostname or IP address of the server. This will copy the public key to the ~/.ssh/authorized_keys file on the server.

  1. Configure the server: On the server, you will need to edit the /etc/ssh/sshd_config file and set the PubkeyAuthentication option to yes. This will enable public key authentication on the server.
PubkeyAuthentication yes
  1. Restart the SSH service.
Created Time:2017-10-29 22:08:38  Author:lautturi