简体   繁体   中英

How do I run win32-openssh through the powershell? (installed with install-package from chocolatey provider)

So I am just trying to convert to powershell from bash. I was trying to find a way to SSH my server, and found out I could install win32-openssh to do so.

I installed it by:

  1. Installing chocolatey as packageprovider using:

    install-packageprovider chocolatey

  2. Then i installed win32-openssh with the command:

    install-package win32-openssh

My problem is now, how do I run this program?

It installs the correct binaries etc. It will not add some PS cmdlets for the use off ssh inside PS.

It is all described on the package site :

This package performs the following operations that you normally have to hack at until you get what you want:

  • Install Appropriate Bitness for the version of Windows
  • Install to Program Files (malware protection and following advice of dev team)
  • Add SSH location to System PATH
  • Optionally install sshd windows service (Requires parameter - see below)
  • Optionally install sshd server "key based authentication" (Requires parameter - see below)
  • Cleanly uninstall all of the above (removing config files and server keys requires special switch - see below)

So you can run it from start menu, or by typing ssh.exe into a prompt.

You have Two Options I can think of.

  • Option 1 : Use bash on Windows 10. Bash comes bundled with Windows 10. You can just enable a Windows 10 feature for it. Setup bash on Windows 10 . You'll never miss bash again even if you're on Windows. [ Recommended Option ]
  • Option 2 : Set up SSH on Powershell by installing a package like PoSH-SSH .

Steps :

Pre-requisite : PC running Windows 10 . Open PowerShell in Admin mode .

  1. Find-Module PoSH-SSH

    type 'Y' for the prompts.

  2. Install-Module Posh-SSH

    type 'A' for the prompts.

Reference: https://www.thomasmaurer.ch/2016/04/using-ssh-with-powershell/

There's not really a need for this. If you have git installed on your Windows machine, you can add it's usr/bin folder to you path. It has ssh and other Unix tools you can use just like in Bash in PowerShell or CMD.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM