【问题标题】:Can't start program via SSH in windows 10无法在 Windows 10 中通过 SSH 启动程序
【发布时间】:2019-03-15 23:13:58
【问题描述】:

我在 Windows 10 上启用了最新的 openSSH。使用密钥成功登录(因为使用时没有任何密码/空白密码)。但是启动程序的命令:

start notepad.exe 

start "C:\Program Files\7-Zip\7zFM.exe"

当我从 linux 系统进行 SSH 时,实际上并没有启动程序(没有任何反应)。

但是,如果我从 Windows 本身的 CMD 运行它(使用 SSH 登录,ssh user@192.123.0.123 -i "key"),它就会运行。这是为什么呢?

谢谢。

【问题讨论】:

  • openSSH 是否在 Windows 设备上作为服务运行?如果是这样,请尝试runas /user:youruser "C:\Windows\notepad.exe" 如果可行,我会解释。
  • 以非登录用户身份启动的程序是不可见的。
  • @GerhardBarnard 它看起来可以工作,但是由于用户没有任何密码(这就是 SSH 使用密钥的原因),我收到错误消息说 RUNAS ERROR: unable to run - C:\Windows\notepad.exe" 1327: Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced. 有没有办法改为使用密钥文件?
  • 好的,那么您打算实际打开notepad.exe 吗?或者你想启动一些特定的东西,比如做一些自动化的脚本等?请用你的计划更新你的问题,然后我可以给你一些想法。
  • 我实际上是在尝试在"C:\Program Files\MyProgram\Program.exe" 上运行已安装的程序,但例如有意让我们使用"C:\Program Files\7-Zip\7zFM.exe" 作为替代。

标签: windows batch-file ssh


【解决方案1】:

我能够使用服务管理工具在 Windows 10 上启动 OpenSSH(并设置为在 Windows 启动时自动启动)。

首先,我通过管理可选功能(使用 Windows 搜索栏搜索可选功能)添加了 OpenSSH 客户端和 OpenSSH 服务器 - 请参阅 Installation of OpenSSH For Windows Server 2019 and Windows 10

安装 OpenSSH 后,我启动了它。您可以通过在 Windows 搜索栏中键入“服务”轻松找到它,向下滚动并找到“OpenSSH SSH 服务器”,右键单击并单击“开始”。

您也可以通过右键单击,选择属性并将启动类型设置为“自动”来设置服务自动启动。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-06
    • 2021-10-04
    • 2012-11-11
    • 2016-05-18
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多