# Linux SSH Key Management

See this article for an update based on obsolete SHA-1 RSA key usage: <span data-annotation-inline-node="true" data-annotation-mark="true" data-card-url="https://askubuntu.com/questions/1409105/ubuntu-22-04-ssh-the-rsa-key-isnt-working-since-upgrading-from-20-04" data-inline-card="true" data-renderer-start-pos="71"><span class="loader-wrapper"><span data-testid="hover-card-trigger-wrapper">[<span class="_19itglyw _vchhusvi _r06hglyw _o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66" data-testid="inline-card-icon-and-title"><span class="_19itglyw _vchhusvi _r06hglyw">Ubuntu 22.04 SSH the RSA key isn't working since upgrading from 20.04</span></span>](https://askubuntu.com/questions/1409105/ubuntu-22-04-ssh-the-rsa-key-isnt-working-since-upgrading-from-20-04)</span></span></span>

NOTE: We currently have two tutorials for this, that need to be consolidated into one. So, maybe this alternate tutorial fills your use-case: [How to Setup SSH Key Authentication to Linux](https://wiki.galaxydump.com/link/444 "https://wiki.galaxydump.com/link/444")

### Step 1 - Key Creation

Follow this page for creating keys in Linux: [Creating SSH Keys in Linux](https://wiki.galaxydump.com/link/210 "https://wiki.galaxydump.com/link/210")

Or, Follow this page for creating keys in Windows: [Creating SSH Keys in Windows](https://wiki.galaxydump.com/link/388 "https://wiki.galaxydump.com/link/388")

After following one of the above tutorials, you should have a public and private key that you can use to authenticate.

The next step is to place the public key on your server so that you can use SSH-key-based authentication to log in.

### Step 2 — Copying the Public Key to a Linux Server

There’s a couple ways to add an SSH public key to a remote host:

- Using SSH-Copy-ID
- Using CAT
- Manually Copying

#### Using SSH-Copy-ID

The quickest way to copy your public key to the Ubuntu host is to use a utility called `ssh-copy-id`. Due to its simplicity, this method is highly recommended if available.

See this page for how to use it: [Adding SSH Keys with ssh-copy-id](https://wiki.galaxydump.com/link/445 "https://wiki.galaxydump.com/link/445")

#### Using CAT

If you do not have `ssh-copy-id` available, but you have password-based SSH access to an account on your server, you can upload your keys using a conventional SSH method.

Here’s a method for uploading an SSH key with cat: [Adding SSH Keys with CAT](https://wiki.galaxydump.com/link/446 "https://wiki.galaxydump.com/link/446")

#### Manually Copying

If you don’t have SSH access to the remote host, you will need to directly paste in a user’s SSH public key.

See this page for how to manually add SSH keys to a Linux host: [Linux: Manually Installing SSH Keys](https://wiki.galaxydump.com/link/440 "https://wiki.galaxydump.com/link/440")

### Step 3 — Authenticating to Your Ubuntu Server Using SSH Keys

If you have successfully completed one of the procedures above, you should be able to log into the remote host *without* providing the remote account’s password.

See this page for how to: [Authenticating to Linux Server with SSH Keys](https://wiki.galaxydump.com/link/442 "https://wiki.galaxydump.com/link/442")

If key-based authentication was successful, continue on to learn how to further secure your system by disabling password authentication.

### Step 4 — Disabling Password Authentication on Your Server

Once you have confirmed that you can access the VM, with SSH key authentication, follow this page to disable password authentication: [Linux: Disabling Password Authentication](https://wiki.galaxydump.com/link/443 "https://wiki.galaxydump.com/link/443")

### Conclusion

You should now have SSH-key-based authentication configured on your server, allowing you to sign in without providing an account password.

If you’d like to learn more about working with SSH, take a look at our [SSH Essentials Guide](https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys "https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys").