Add ssh public key to ssh server

nguyennamdsn | Nov. 9, 2022, 10:34 p.m.

1, generate ssh key in client computer

ssh-keygen -q -b 2048 -P "" -f C:\Users\<localuser>\.ssh\keys\<myhost>_rsa -t rsa

2, Add configuration in

C:\Users\<localuser>\.ssh\config
Host <myhost>
  HostName IP or domain
  User <remoteuser>
  Port 22
  PreferredAuthentications publickey
  IdentityFile "C:\Users\<localuser>\.ssh\<myhost>_rsa"

3,Create authorized_keys in server

 <remoteuserhome>/.ssh/authorized_keys

4, Add content public key into the end of authorized_keys file

Done



0
1

Leave a comment:

Comments:

? Nov. 16, 2022, 12:13 p.m. wrote:

??