■Win10側
powershell起動
C:\Users\your_account.sshに移動する。
> cd C:\Users\your_account\.ssh
keyを作成する
> ssh-keygen
The program will ask you for a file name, just press enter
It will then ask you for a passphrase, press enter again and once more to confirm
Demo-win10:.ssh demo$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/demo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/demo/.ssh/id_rsa.
Your public key has been saved in /Users/demo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:g5SyXmke+OAmYSl4nxc4wcRnsyeDO6RE9/Q9FKlcpKY demo@demo-win10-Desktop
The key’s randomart image is:
+—[RSA 2048]—-+
| .. .oo |
| .oo =. .+ |
| . .+*o=o= |
|. ..oB=== o |
|o.=o*.E+S . |
| +.=oO o . |
| . *.+ |
| o . |
| |
+—-[SHA256]—–+
ssh-agentを有効にする
(管理者権限でPowershellを起動する)
> Get-Service ssh-agent
Status Name DisplayName
------ ---- -----------
Stopped ssh-agent OpenSSH Authentication Agent
> Get-Service ssh-agent | Select StartType
StartType
---------
Disabled
> Get-Service -Name ssh-agent | Set-Service -StartupType Manual
> Start-Service ssh-agent
Add the keys to the local Windows 10 keystore
> ssh-add .\id_rsa
PuttyやTeraterm等で公開鍵(id_rsa.pub)の中身をubuntu(/home/you/.ssh/authorized_keys)にコピーする。
ログインする。
> ssh demo@demo-desktop
以上。