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

Setting up an ssh public key for password-less authentication on FreeBSD involves the following steps:

  1. Generate an ssh key pair on your local machine, if you don’t have one already.
ssh-keygen -t rsa
  1. Copy the public key to the remote server.
ssh-copy-id user@remote-server
  1. Configure the remote server to allow password-less authentication by editing the ssh configuration file /etc/ssh/sshd_config and setting the following options:
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
  1. Reload the ssh service on the remote server:
sudo service ssh restart
  1. Test the connection from your local machine to the remote server by running:
ssh user@remote-server

You should be able to connect to the remote server without being prompted for a password.

Please note that this is just a basic setup, in order to use it in production environment you should consider security and performance configurations. It’s always a good idea to check the ssh website for the latest version and installation instructions.

Also, it’s recommended to use ssh-keygen -a option to increase the number of KDF (Key Derivation Function) rounds to make the private key more secure.

Leave a Comment