• [WSL][ubuntu][原创]windows上ssh WSL的linux子系统


    登录后安装

    sudo apt install openssh-client openssh-server

    修改配置:sudo vi /etc/ssh/ssh_config

    #   GSSAPIKeyExchange no
    #   GSSAPITrustDNS no
    #   BatchMode no
    #   CheckHostIP yes
        AddressFamily any
    #   ConnectTimeout 0
    #   StrictHostKeyChecking ask
    #   IdentityFile ~/.ssh/id_rsa
    #   IdentityFile ~/.ssh/id_dsa
    #   IdentityFile ~/.ssh/id_ecdsa
    #   IdentityFile ~/.ssh/id_ed25519
        Port 22
        ListenAddress 0.0.0.0
        PermitRootLogin no
        PasswordAuthentication yes
    #   Protocol 2
    #   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
    #   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
    #   EscapeChar ~
    #   Tunnel no
    #   TunnelDevice any:any
    #   PermitLocalCommand no
    #   VisualHostKey no
    #   ProxyCommand ssh -q -W %h:%p gateway.example.com
    #   RekeyLimit 1G 1h
        SendEnv LANG LC_*
        HashKnownHosts yes
        GSSAPIAuthentication yes

    重启ssh服务:

    sudo service ssh restart

    查看自己的ip地址:

    ifconfig

    fut@DESKTOP-19QNH4E:~$ ifconfig
    eth0: flags=4163  mtu 1500
            inet 172.21.7.62  netmask 255.255.240.0  broadcast 172.21.15.255
            inet6 fe80::215:5dff:fef7:b154  prefixlen 64  scopeid 0x20
            ether 00:15:5d:f7:b1:54  txqueuelen 1000  (Ethernet)
            RX packets 48378  bytes 72720775 (72.7 MB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 9399  bytes 875394 (875.3 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    lo: flags=73  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 32  bytes 4926 (4.9 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 32  bytes 4926 (4.9 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    登录:

    ssh fut@172.21.7.62

    注意端口22需要加入入站规则

    配置Windows防火墙

    打开windows Definder的高级设置:

    • 点击左侧“入站规则”
    • 点击右侧“新建规则”
    • 选择“端口”
    • 选择"TCP"
    • 选择“特定本地端口”,并设定值为2222(与之前配置端口映射时的本机端口一致即可)

  • 相关阅读:
    Chrome Thems 介绍
    基于hexo框架快速从0到1搭建个人博客----评论功能(二)
    Linux下修改jar包中的配置文件application.conf
    Python实现双目标定、畸变矫正、立体矫正
    .NET跨平台框架选择之一 - Avalonia UI
    day02小程序快速入门
    深入理解Linux内核select多路复用原理
    1695. 删除子数组的最大得分-哈希表+双指针
    Threejs_02 父子位移+缩放改变
    剑指 Offer II 033. 变位词组
  • 原文地址:https://blog.csdn.net/FL1623863129/article/details/126024188