分享 powershell ssh to Linux 脚本。

2019-12-26 14:42:55 +08:00
 ps1aniuge
------概述-----

win 连接 linux,有 3 种情况。
1 win 的 cmd to linux 的 bash
2 win 的 powershellv6,v7 to linux 的 bash
3 win 的 powershellv6,v7 to linux 的 powershell。



------讲解上述情况 2-----
在 powershell 中运行:ssh root@ip
在 win term 中编写

"commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe -noexit -command 'ssh root@ip' ",


------讲解上述情况 3-----
3.1 脚本下载地址:
powershell 入门资料下载:含绝大多数电子书,入门基础资料。
https://pan.baidu.com/s/1p2zK-BewhursJxDNQnq5PQ



3.2 需求:
需要 linux 中安装 powershell,并改写 sshd 配置文件。
需要先配好 sshkey。

3.3 脚本用途:

3.3.1 在 powershell v6,v7 中,直接运行 ssh_to_centos7.ps1 ,可以进入 linux powershell 命令行。

3.3.2 建议改写 win term 标签配置文件。
{
"acrylicOpacity" : 0.5,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"tabTitle" : "ps62",
"commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe -noexit -file d:\\ps\\ssh_to_centos7.ps1",
"scrollbarState": "visible",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Monaco_YH_Nero_Mono",
"fontSize" : 18,
"guid" : "{c3d2cb60-5f6d-4e83-89ee-eec17960fc9a}",
"historySize" : 9001,
"icon" : "ms-appx:///ProfileIcons/{574e775e-4f2a-5b96-ac1e-a2962a402336}.png",
"name" : "PowerShell Core 7",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "c:\\ProgramData\\kasini3000",
"backgroundImage": "d:\\ps 壁纸.jpg",
"backgroundImageAlignment": "center",
"backgroundImageAlignment": "uniformToFill",
"backgroundImageOpacity" : 0.2
},

编写并保存后,点击 win term 标签,即可打开远程终端,基本可以代替终端软件。
2865 次点击
所在节点    PowerShell
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/632549

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX