Powershellを使用してOpenSSHをインストール

ssh <username>@<hostname>.local (または ssh <username>@<IPアドレス> )を使用してRaspberry Piに接続しようとすると、次のエラーメッセージが表示される場合があります。

ssh: The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.

これは、コンピューターシステムが古すぎて OpenSSH が事前にインストールされていないことを意味します。以下のチュートリアルに従って、手動でインストールする必要があります。

  1. Windowsデスクトップの検索ボックスに powershell と入力し、 Windows PowerShell を右クリックし、表示されるメニューから 管理者として実行 を選択します。

    ../_images/powershell_ssh.png
  2. 以下のコマンドを使用して OpenSSH.Client をインストールします。

    Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    
  3. インストール後、以下の出力が返されます。

    Path          :
    Online        : True
    RestartNeeded : False
    
  4. 次のコマンドを使用してインストールを確認します。

    Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
    
  5. これにより、 OpenSSH.Client が正常にインストールされたことがわかります。

    Name  : OpenSSH.Client~~~~0.0.1.0
    State : Installed
    
    Name  : OpenSSH.Server~~~~0.0.1.0
    State : NotPresent
    

    警告

    上記のプロンプトが表示されない場合、Windowsシステムがまだ古い可能性があり、 PuTTY のようなサードパーティのSSHツールをインストールすることをお勧めします。

  6. 今、PowerShellを再起動し、管理者として実行し続けます。この時点で、 ssh コマンドを使用してRaspberry Piにログインできるようになり、以前に設定したパスワードを入力するように求められます。

    ../_images/powershell_login.png