Configure SSH Key-Based Authentication on Linux @i12bretro
Configure SSH Key-Based Authentication on Linux  @i12bretro
Uploaded June 2023 | Updated November 2026, 3 hours ago
#SSH #Linux #KeyBasedAuthentication #Certificates

Full steps can be found at i12bretro.github.io/tutorials/0554.html

--------------------------------------------------------------------
Connecting from a Linux Host
--------------------------------------------------------------------
   01. Log into the source Linux host
   02. Run the following command in a terminal window
         # generate a new ssh key pair
         ssh-keygen -t rsa
   03. Press enter to accept the default location
   04. Optionally, set a password for the key pair
NOTE: If you don't provide a password, anyone with the key and access to the target host can connect using the key. Proceed with caution
   05. Continue with the following command
         # output the public key
         cat ~/.ssh/id_rsa.pub
   06. Copy the output ssh-rsa public key to the clipboard
   07. Log into the target Linux machine
   08. Run the following command in a terminal window
         # create .ssh directory
         mkdir ~/.ssh -p
         # edit the authorized_keys file
         nano ~/.ssh/authorized_keys
   09. Paste the copied public key to the bottom of the file
   10. Press CTRL+O, Enter, CTRL+X to write the changes
   11. Back on the source Linux device, connect to the Linux target using ssh (ie ssh username@hostname)
   12. Type yes and press Enter the first time connecting with a new public key to accept the connection
 
--------------------------------------------------------------------
Connecting from a Windows Host
--------------------------------------------------------------------
   01. Log into the Windows host
   02. Right click the Start menu ≫ Run ≫ Type cmd ≫ Press Enter
   03. Run the following command in the command prompt
         # generate a new ssh key pair
         ssh-keygen -t rsa
   04. Press enter to accept the default location
   05. Optionally, set a password for the key pair
NOTE: If you don't provide a password, anyone with the public key and access to the target host can connect using the key
   06. Continue with the following command
         # output the public key
         type %userprofile%\.ssh\id_rsa.pub
   07. Copy the output ssh-rsa public key to the clipboard
   08. Log into the target Linux machine
   09. Run the following command in a terminal window
         # create .ssh directory
         mkdir ~/.ssh -p
         # edit the authorized_keys file
         nano ~/.ssh/authorized_keys
   10. Paste the copied public key to the bottom of the file
   11. Press CTRL+O, Enter, CTRL+X to write the changes
   12. Back on the Windows device, connect to the Linux target using ssh (ie ssh username@hostname)
   13. Type yes and press Enter the first time connecting with a new public key to accept the connection
 


### Connect with me and others ###
★ Discord: discord.com/invite/EzenvmSHW8
★ Reddit: reddit.com/r/i12bretro
★ Twitter: twitter.com/i12bretro
Configure SSH Key-Based Authentication on LinuxRun Dashy Application Dashboard in DockerContainerized Self-Hosted ACME Server with Step-CA in DockerSony PlayStation 4 Boot Animationi12bretro Plays the [Hated?] Video Background MusicRunning phpBB Bulletin Board/Forum in Docker on Ubuntu ServerQuickly Deploy an Apache/PHP/MySQL Development Environment in DockerInstall Invoice Plane - Invoice and Payment Manager - On LinuxRunning a MacOS 15 Sequoia VM in VMwareRun FocalBoard - Project and Task Management Platform - in DockerRoll Your Own Google Analytics Alternative with Umami on WindowsInstall AdGuard Home - Cross Platform Pi Hole Alternative - on OpenWRT Router
i12bretro |

Configure SSH Key-Based Authentication on Linux

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER