1
0
hugo/content/blog/2017-06-06-windows.md
2024-04-23 22:21:26 +09:00

33 lines
943 B
Markdown

+++
date = "2017-06-06"
tags = ["windows"]
title = "windows-openssh-key"
slug = "windows"
+++
Windowsのsshd(github.com/PowerShell/Win32-OpenSSH)によってsshサーバーを立て、ホストからキーを作成し、それを`c:users/$user/.ssh/authorized_keys`にscpなりすることで接続できるはずなんですが、できなかった話。
結論としてPATHが通ってないことが原因です。`$authorizedKeyPath`
```bash
# windowsのpathは適時置き換えてください。
$ scp ~/.ssh/test.pub windows:.ssh/authorized_keys
$ ssh -i ~/.ssh/test.pub admin@192.168.11.XX
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
```
PowerShellで以下のコマンドを実行。
```bash
# pathは置き換えてください。
## https://github.com/PowerShell/Win32-OpenSSH/wiki/ssh.exe-examples
$authorizedKeyPath = ...
...
```
Ref :
https://github.com/PowerShell/Win32-OpenSSH/wiki/ssh.exe-examples