3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Windows10 で ssh-agent のサービスを登録する

Posted at

状態

scoopWindowsのオプション機能でOpenSSHがインストールしてある状態で、

gcm ssh-agent

はちゃんとパスが返ってくるのに

get-service ssh-agent

は見つからない状態

サービスの登録

管理者としてPowerShellを起動
以下コマンドを実行
ssh-agent.exe のパスは gcm ssh-agent -All | select -Property Source で出力された内、好きなものを入力

New-Service -Name ssh-agent -BinaryPathName C:\Windows\System32\OpenSSH\ssh-agent.exe

ssh-agent に鍵を登録する

Start-Service ssh-agent
Get-Service ssh-agent
# Status が Running であることを確認する
ssh-add C:\Users\MYUSERNAME\.ssh\id_ed25519

ssh-agent を自動起動する

Set-Service -Name ssh-agent -StartupType AutomaticDelayedStart

おまけ

ServiceまわりのPowerShellコマンドレットは以下で確認出来る

 gcm -Noun service

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-Service                                        7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          New-Service                                        7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Remove-Service                                     7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Restart-Service                                    7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Resume-Service                                     7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Set-Service                                        7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Start-Service                                      7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Stop-Service                                       7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Suspend-Service                                    7.0.0.0    Microsoft.PowerShell.Management
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?