简体   繁体   English

如何通过Powershell运行win32-openssh? (与Chocolatey提供程序的安装包一起安装)

[英]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. 所以我只是想从bash转换为powershell。 I was trying to find a way to SSH my server, and found out I could install win32-openssh to do so. 我试图找到一种方法来对我的服务器进行SSH,发现可以安装win32-openssh来这样做。

I installed it by: 我通过以下方式安装它:

  1. Installing chocolatey as packageprovider using: 使用以下命令将Chocolatey作为packageprovider安装:

    install-packageprovider chocolatey 安装程序包提供商巧克力

  2. Then i installed win32-openssh with the command: 然后我使用以下命令安装了win32-openssh:

    install-package win32-openssh 安装软件包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. 它会安装正确的二进制文件等。不会在PS内的ssh中添加一些PS cmdlet以供使用。

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 为Windows版本安装适当的位数
  • Install to Program Files (malware protection and following advice of dev team) 安装到程序文件(恶意软件保护和开发人员的建议)
  • Add SSH location to System PATH 将SSH位置添加到系统路径
  • Optionally install sshd windows service (Requires parameter - see below) (可选)安装sshd Windows服务(Requires参数-参见下文)
  • Optionally install sshd server "key based authentication" (Requires parameter - see below) (可选)安装sshd服务器“基于密钥的身份验证”(需要参数-参见下文)
  • 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. 因此,您可以从开始菜单运行它,也可以在提示符下键入ssh.exe来运行它。

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. 选项1:在Windows 10上使用bash。Bash与Windows 10捆绑在一起。您只需为其启用Windows 10功能。 Setup bash on Windows 10 . 在Windows 10上安装bash You'll never miss bash again even if you're on Windows. 即使您使用Windows,也永远不会再错过bash。 [ Recommended Option ] [ 推荐选项 ]
  • Option 2 : Set up SSH on Powershell by installing a package like PoSH-SSH . 选项2:通过安装PoSH-SSH之类的软件包在Powershell上设置SSH

Steps : 脚步 :

Pre-requisite : PC running Windows 10 . 先决条件:运行Windows 10的 PC。 Open PowerShell in Admin mode . Admin模式下打开PowerShell

  1. Find-Module PoSH-SSH

    type 'Y' for the prompts. 在提示中输入“ Y”。

  2. Install-Module Posh-SSH

    type 'A' for the prompts. 提示时输入“ A”。

Reference: https://www.thomasmaurer.ch/2016/04/using-ssh-with-powershell/ 参考: 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. 如果您在Windows计算机上安装了git,则可以将它的usr / bin文件夹添加到您的路径中。 It has ssh and other Unix tools you can use just like in Bash in PowerShell or CMD. 它具有ssh和其他Unix工具,您可以像在PowerShell或CMD中的Bash中一样使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在正常的PowerShell会话中(不在Visual Studio中)运行Nuget PowerShell cmdlet Install-Package? - How can I run Nuget PowerShell cmdlet Install-Package in normal PowerShell session (not inside Visual Studio)? 如何使用 Install-Package 为 PowerShell 安装 MongoDB 驱动程序? - How do I install MongoDB driver for PowerShell using Install-Package? Nuget的Powershell安装包 - Powershell Install-Package from Nuget 如何使用nuget.org的OneGet / install-package安装软件包 - How do I install a package using OneGet / install-package from nuget.org Find-Package 有效,但 Install-Package 在 powershell 中使用 Chocolatey 仅显示 nuget 错误 - Find-Package works but Install-Package shows only nuget error using chocolatey in powershell 如何在PowerShell中使用install-package cmdlet安装多个包? - How to install multiple packages using install-package cmdlet in powershell? 在powershell中获取由chocolatey安装的软件包的安装路径 - Getting Install path of a package just installed by chocolatey in powershell 带有Chocolatey的install-package从不向路径环境变量添加任何内容 - install-package with chocolatey never adds anything to the path environment variable 如何在Chocolatey软件包安装脚本中指定端口? - How do I specify a port in a Chocolatey package install script? Powershell: How do I install the Nuget provider for PowerShell on a unconnected machine so I can install a nuget package from the PS command line? - Powershell: How do I install the Nuget provider for PowerShell on a unconnected machine so I can install a nuget package from the PS command line?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM