Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Key Based SSH from Windows to Linux: Difference between revisions

From Thibble Wiki
Created page with "== Passwordless SSH: == First on the client in power-shell run ssh-keygen from the user account you will be accessing with, and follow the prompts to create an SSH pair, and name them. You can choose note to add a password to the Keys, to make to not require one for SSH. image Now copy the public key (Default name id_rsa.pub) created by the client in the C:/Users/USER/.ssh/ directory, to the server with your method of choice. If this is an initial config, just ssh int..."
 
Line 3: Line 3:
First on the client in power-shell run ssh-keygen from the user account you will be accessing with, and follow the prompts to create an SSH pair, and name them. You can choose note to add a password to the Keys, to make to not require one for SSH.
First on the client in power-shell run ssh-keygen from the user account you will be accessing with, and follow the prompts to create an SSH pair, and name them. You can choose note to add a password to the Keys, to make to not require one for SSH.


image
 


Now copy the public key (Default name id_rsa.pub) created by the client in the C:/Users/USER/.ssh/ directory, to the server with your method of choice. If this is an initial config, just ssh into the server using a password, use copy/paste, and echo to put the key in the home directory of the server user, in the directory with the name: ~/.ssh/authorized_keys.
Now copy the public key (Default name id_rsa.pub) created by the client in the C:/Users/USER/.ssh/ directory, to the server with your method of choice. If this is an initial config, just ssh into the server using a password, use copy/paste, and echo to put the key in the home directory of the server user, in the directory with the name: ~/.ssh/authorized_keys.
Line 17: Line 17:
NOTE: this will disable password based ssh from other users, to the server system
NOTE: this will disable password based ssh from other users, to the server system


image
 


Finally restart sshd using systemctl, and your Key based SSH is configured. Just ssh into the system using the normal command syntax, and you will be prompted if a key password was set, if not you will be logged in with no password request.
Finally restart sshd using systemctl, and your Key based SSH is configured. Just ssh into the system using the normal command syntax, and you will be prompted if a key password was set, if not you will be logged in with no password request.

Revision as of 03:10, 30 August 2024

Passwordless SSH:

First on the client in power-shell run ssh-keygen from the user account you will be accessing with, and follow the prompts to create an SSH pair, and name them. You can choose note to add a password to the Keys, to make to not require one for SSH.


Now copy the public key (Default name id_rsa.pub) created by the client in the C:/Users/USER/.ssh/ directory, to the server with your method of choice. If this is an initial config, just ssh into the server using a password, use copy/paste, and echo to put the key in the home directory of the server user, in the directory with the name: ~/.ssh/authorized_keys.

You can do this with echo "KEYCONTENTHERE" >> /home/USER/.ssh/authorized_keys

Now enter the ssh config file on the server, located in /etc/ssh/sshd_config, and add the following to the file:

RSAAuthentication yes PubkeyAuthentication yes to the end of the file. If you want to disable password based SSH set set PasswordAuthentication to no

NOTE: this will disable password based ssh from other users, to the server system


Finally restart sshd using systemctl, and your Key based SSH is configured. Just ssh into the system using the normal command syntax, and you will be prompted if a key password was set, if not you will be logged in with no password request.