-
Notifications
You must be signed in to change notification settings - Fork 0
Key Based SSH from WIndows to Linux
-
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
tono
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.