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

使用 Windows Terminal 替代 Xshell

  •  
  •   godlovesxcjtest · 2020-04-29 19:08:50 +08:00 · 9198 次点击
    这是一个创建于 1457 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用过一段时间的 Xshell 和 Mobaxterm,功能确实强大,但是我只是需要一个简单的 ssh 管理软件,有 ssh 功能、能帮我记住 ip 就可以,正好赶上 WSL2 即将正式推出,那就折腾一下 windows terminal 吧,反正 wsl2 发布了肯定会用。

    在配置里面添加几行就可以使用了

    {
      "commandline": "powershell.exe ssh [email protected]",
      
      "guid": "{2d774c23-c36e-4361-8991-9712e5af58c8}",
      
      "hidden": false,
      
      "icon": "C:\\Users\\godlo\\.ssh\\linux.png",
      
      "name": "N1-Armbian"
    }
    

    这是效果图,配置 SSH 公钥登录后,使用确实很方便,还可以快捷键快速打开对应标签,直接连接 J7DIlq.png 但是有一个问题,就是不支持 ZModem 协议,也就不能使用 rz 和 sz 这样的命令,目前只能使用 sftp 简单的替代下 如下图: J7rJ9s.png

    大家有什么好的办法么?

    11 条回复    2020-05-05 08:45:58 +08:00
    codehz
        1
    codehz  
       2020-04-29 19:11:13 +08:00 via Android
    (我建议用专用软件代替,喜欢 uwp 的可以用 Token2Shell (
    MeteorCat
        2
    MeteorCat  
       2020-04-29 19:13:17 +08:00 via Android
    xshell 主要是密钥证书管理,不是什么花里胡哨的
    godlovesxcjtest
        3
    godlovesxcjtest  
    OP
       2020-04-29 19:13:20 +08:00
    @codehz #1 这不是为信仰充值嘛
    iamwho
        4
    iamwho  
       2020-04-29 19:13:22 +08:00
    ~\.ssh\config:"???"
    godlovesxcjtest
        5
    godlovesxcjtest  
    OP
       2020-04-29 19:14:40 +08:00
    @MeteorCat #2 我说他花里胡哨了吗??,我自己也挺喜欢 xshell 的
    ragnaroks
        6
    ragnaroks  
       2020-04-29 19:46:15 +08:00
    只有我是当 cmd 替代用的?
    Norie
        7
    Norie  
       2020-04-29 20:00:58 +08:00 via iPhone
    win10 就是最好的 Linux 发行版
    lionseun
        8
    lionseun  
       2020-04-30 08:57:57 +08:00 via Android
    @iamwho 我就是用这个
    godlovesxcjtest
        9
    godlovesxcjtest  
    OP
       2020-04-30 09:37:13 +08:00
    @lionseun #8 所以更改客户端的 ssh config 可以支持[xyz]Modem 吗?具体怎样做呢
    ps1aniuge
        10
    ps1aniuge  
       2020-04-30 22:58:19 +08:00
    ## 目的:打开一个新 win term 标签后,则进入 linux 种的,powershell 远程命令行。

    ## win term:
    "commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe -noexit -file d:\\ps 脚本\\ssh_to_ps62.ps1",


    ## ssh_to_ps62.ps1
    param
    (
    [String]$目的 ip 地址 = '192.168.1.62',
    $端口 = 22,
    $账户 = 'root',
    $ssh_key_文件路径 = "$env:USERPROFILE\.ssh\id_rsa"
    )

    $msg = @'
    需要 ssh.exe,低版本 win 请去这里下载: https://github.com/PowerShell/Win32-OpenSSH/releases
    建议在 Windows Terminal 中使用:
    "commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe -noexit -file d:\\ps 脚本\\centos7.ps1",
    '@

    Write-Warning $msg


    if ($PSVersionTable.psversion.major -ge 6)
    {
    Write-Host -ForegroundColor green "进入目的 ip [$目的 ip 地址] "
    Enter-PSSession -Session (New-PSSession -HostName $目的 ip 地址 -Port $端口 -UserName root -KeyFilePath $ssh_key_文件路径)
    }
    else
    {
    Write-Error '需要 powershell 版本 v6 。v7 更好'
    }

    ##linux:
    linux 下需要安装 powershell,并修改 /etc/ssh/sshd_config 文件。
    使用这里的脚本,可以一键安装,修改。

    https://gitee.com/chuanjiao10/kasini3000_agent_linux
    lionseun
        11
    lionseun  
       2020-05-05 08:45:58 +08:00 via Android
    @godlovesxcjtest ssh config 只是方便 ssh 相关的操作,比如 ssh 连主机,SCP 拉文件
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1280 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:30 · PVG 07:30 · LAX 16:30 · JFK 19:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.