--- title: "How to: Settingup key based authentication" slug: "how-to-setting-up-key-based-authentication" updated: 2026-06-30T04:43:23Z published: 2026-06-30T04:43:23Z canonical: "docs.serversaustralia.com.au/how-to-setting-up-key-based-authentication" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.serversaustralia.com.au/llms.txt > Use this file to discover all available pages before exploring further. # How to: Setting up key based authentication The following guide shows how to setup key based authentication for Linux servers **1.** Create your SSH Key (On your local machine - Guides: [**Windows**](https://docs.serversaustralia.com.au/docs/how-to-generate-an-ssh-key-windows) | [**Linux**](https://docs.serversaustralia.com.au/docs/how-to-generate-an-ssh-key)**)** **2.** There are multiple ways to upload your public key to your remote SSH server. The method you use depends largely on the tools you have available and the details of your current configuration. The location this needs to be uploaded to: `~/.ssh` directory name: `authorized_keys` For Linux and Mac users this can be done with; ```shell ssh-copy-id username@remote_host ``` **3.** If you have successfully completed coping your ssh public key to your server, you should be able to log into the remote host without the remote account’s password. The process to login is; ```shell ssh username@remote_host ``` **4.** Disabling Password Authentication on your Server If you were able to log in to your account using SSH without a password, you have successfully configured SSH key-based authentication to your account. However, your password-based authentication mechanism is still active. ```shell sudo nano /etc/ssh/sshd_config ``` Inside the file, search for a directive called PasswordAuthentication. This may be commented out. Uncomment the line by removing any # at the beginning of the line, and set the value to no. This will disable your ability to log in through SSH using account passwords: ![](https://cdn.document360.io/d809f158-d4f4-47ff-83d4-18d9c9f7a04d/Images/Documentation/image-1660019245388.png) Save and close the file when you are finished **5.** Restart the SSH Service To implement the changes you've just made, you must restart the service. On most Linux distributions, you can issue the following command to do that: ```shell sudo systemctl restart sshd ``` After completing this step, you’ve successfully transitioned your SSH daemon to only respond to SSH keys.