美文网首页
WindowsTerminal 连接远程Linux服务器

WindowsTerminal 连接远程Linux服务器

作者: AlexWillBeGood | 来源:发表于2020-08-18 09:44 被阅读0次

之前使用Terminus挺好用的,但是重装系统后发现找不到原来那个版本了,故转用WindowsTerminal。

安装配置WindowsTerminal

可在WindowsStore中找到WindowsTerminal

image.png

添加Linux远程服务器连接

软件默认连接方式只有三种。


image.png

点击设置,配置settngs.json就可以进行配置。

"list": [
      {
        // Make changes here to the powershell.exe profile.
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "name": "Windows PowerShell",
        "commandline": "powershell.exe",
        "hidden": false
      },
      {
        // Make changes here to the cmd.exe profile.
        "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
        "name": "命令提示符",
        "commandline": "cmd.exe",
        "hidden": false
      },
      //新添加Linux选项卡
      {
        "guid": "{439227e1-65b3-4a60-a518-74afeca0c7c0}",
        "hidden": false,
        "name": "Linux",
        "commandline": "ssh 用户名@域名或者IP -p 端口号",
        //自定义样式风格
        "icon": "",
        "acrylicOpacity": 0.5,
        "backgroundImageOpacity": 0.5,
        "cursorShape": "bar",
        "padding": "0, 0, 0, 0",
        "snapOnInput": true,
        "tabTitle": "Linux",
        "useAcrylic": true
      }
    ]

配置完成后多出一个选项卡


image.png

设置免密登陆

使用命令ssh-keygen生成密钥对,按照默认配置即可。

image.png
将路径中的公钥文件id_rsa.pub上传到服务器,可以使用工具WinSCP进行上传。
执行命令:
cd ~
# mkdir .ssh
# chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
# 添加公钥
cat id_rsa.pub >> .ssh/authorized_keys
rm id_rsa.pub

如果不想让ssh连接很快断开的话需要去Linux服务端配置

vim /etc/ssh/sshd_config
#2分钟间隔
ClientAliveInterval 600
#断开次数上限
ClientAliveCountMax 100

相关文章

网友评论

      本文标题:WindowsTerminal 连接远程Linux服务器

      本文链接:https://www.haomeiwen.com/subject/ndjhjktx.html