如何在PowerShell上正确运行Cygwin SSH?
我的操作系统是Windows 10(x64),我同时安装了PowerShell 7和Cygwin。
然后,我使用Cygwin安装了“ SSHPASS”。
而且,这是我现在正在经历的情况。
从cmd中,如果我输入“ c:\ cygwin64 \ bin \ mintty.exe-”,cygwin弹出了初始目录“〜”。然后,如果我键入“ sshpass -p< password> ssh< username>@@host; host>',它完美地工作得很好!
从cmd中,如果我输入“ C:\ cygwin64 \ bin \ mintty.exe”,Cygwin弹出了目录“/cygdrive/c/c/users/myname”。然后,如果我键入“ sshpass -p< password> ssh< username>@@host; host>'',它要求我输入密码。这意味着SSHPass在这里无法正常工作。
来自PowerShell,如果我键入“ C:\ cygwin64 \ bin \ sshpass.exe -p< password> c:\ cygwin64 \ bin \ bin \ ssh&ssh&ssh< username> >
我的问题如下:
如何在PowerShell中正确运行SSHPASS命令?
假设我的IP地址是1.1.1.1,我正在连接到IP为2.2.2.2的服务器,并且两个计算机OS系统都是Windows。当我通过SSH连接到服务器时,它显示了服务器的“ CMD”终端。连接到服务器时,如何更改它以显示“ Cygwin”终端?
我很难解决这个问题。.非常感谢您。
My OS is Windows 10 (x64) and I installed both Powershell 7 and cygwin.
Then, I installed "sshpass" using cygwin.
And, here are the cases I am experiencing right now.
From cmd, if I enter "C:\cygwin64\bin\mintty.exe -", cygwin pops up with initial directory "~". Then, if I type "sshpass -p<password> ssh <username>@<host>", it perfectly works smoothly!
From cmd, if I enter "C:\cygwin64\bin\mintty.exe", cygwin pops up with directory "/cygdrive/c/Users/myname". Then, if I type "sshpass -p<password> ssh <username>@<host>", it asks me to type the password. This means that sshpass is not working correctly here.
From powershell, if I type "C:\cygwin64\bin\sshpass.exe -p<password> C:\cygwin64\bin\ssh <username>@<host>", nothing happens.
My questions are the following:
How do I properly run sshpass command in Powershell?
Let's say my ip address is 1.1.1.1 and I am connecting to a server whose ip is 2.2.2.2, and both computers OS systems are Windows. When I connect to the server through ssh, it shows the "cmd" terminal of the server. How can I change it to show "cygwin" terminal when I connect to the server?
I am having very hard time fixing this out.. Thank you very much in advance..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无论如何,我不确定我是否会明白,如果我理解正确的话,您很难从PowerShell启动SSHPASS。
尝试使用Start-Process Commandlet :(也许在参数(?)中将完整的路径添加到SSH),
而不是将Linux命令访问Windows并从PowerShell运行,为什么不检查PowerShell模块?
ssh”与Commnad一起
,当今的Powershell远程远程是一件事情,它在SSH上运行(不是Bash afaik)
I am not sure i am getting this, anyway, if i understand correctly you have a hard time launching sshpass from powershell.
Try using Start-Process commandlet: (maybe add the full path to ssh in arguments (?))
Anyway instead of reaching linux commands to windows and run it from powershell, why don't you check powershell modules?
ssh using powerShell script by passing the password along with the Commnad
Also, Powershell Remoting towards linux is a thing nowadays, and it runs over ssh (not bash afaik)