V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ps1aniuge
V2EX  ›  PowerShell

分享 powershell ssh to Linux 脚本。

  •  
  •   ps1aniuge · 2019-12-26 14:42:55 +08:00 · 2853 次点击
    这是一个创建于 1576 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ------概述-----

    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 标签,即可打开远程终端,基本可以代替终端软件。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1870 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 16:20 · PVG 00:20 · LAX 09:20 · JFK 12:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.