zoukankan      html  css  js  c++  java
  • windows通过ssh方式访问CentOS7

    windows安装openSSH-client
    使用PowerShell安装OpenSSH
    要使用PowerShell安装OpenSSH,请首先以管理员身份启动PowerShell。要确保OpenSSH功能可用于安装:
    Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

    安装服务器和/或客户端功能:
    Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

    卸载OpenSSH
    Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

    SSH服务器的初始配置
    Start-Service sshd
    Set-Service -Name sshd -StartupType 'Automatic'
    Get-NetFirewallRule -Name *ssh*
    New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22


    SSH的初次使用
    在Windows上安装OpenSSH服务器后,可以从安装了SSH客户端的任何Windows设备上使用PowerShell快速测试它。在PowerShell中,键入以下命令:
    Ssh username@servername
    --------------------------------------------

    windows 远程 调试CentOS7下面的工程

    1.CentOS7下面安装 SSH server
    sudo yum install openssh-server && sudo systemctl start sshd.service && sudo systemctl enable sshd.service

    2.Windows 安装 SSH client
    Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

    3.windows 生成公钥和私钥
    ssh-keygen -t rsa -b 4096
    不需要输入啥密码,都是回车(如果你的目录下面已经存在其他的ssh私钥,你可以考虑在.ssh目录下面新建文件夹,将新生成的私钥指定到新的文件夹下面)

    3.CentOS7 添加authorized_keys文件
    mkdir /home/henry/.ssh
    vi /home/henry/.ssh/authorized_keys
    把 公钥里面的内容,添加到 authorized_keys 文件(如果authorized_keys之前不存在就先创建)

    ##修改 vim /etc/ssh/sshd_config 配置

    4.windows 远程连接 (用户名@IP地址)的格式,测试是否OK
    C:UsersAdministrator>ssh henry@192.168.163.132 -p 22
    henry@192.168.163.132's password:
    Last login: Sun May 31 23:26:34 2020 from 192.168.163.1
    [henry@localhost ~]$ ls
    cppProject Desktop Documents Downloads Music packageRoot Pictures Public Templates Videos
    [henry@localhost ~]$

    5.vscode 配置 config文件和路径进行连接
    安装 Remote SSH


    https://segmentfault.com/a/1190000019550872
    https://blog.csdn.net/sixdaycoder/article/details/89850064
    https://code.visualstudio.com/docs/remote/troubleshooting#_configuring-key-based-authentication
    https://code.visualstudio.com/docs/remote/ssh
    https://www.man7.org/linux/man-pages/man5/ssh_config.5.html

  • 相关阅读:
    虎牙数万主播同时在线直播的秘密,CDN推流日志上行实时监控
    CDN边缘节点容器调度实践(下)
    CDN边缘节点容器调度实践(上)
    MySQL5.6复制技术(1)-原理详解
    AWS EC2 MySQL迁移到RDS案例
    OCP知识点讲解 之 检查点队列与增量检查点
    利用sqlldr从MySQL导出一张表数据到Oracle
    Oracle 11.2.0.4.0 Dataguard部署和日常维护(7)
    Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Dataguard Snapshot篇
    Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active Dataguard篇
  • 原文地址:https://www.cnblogs.com/music-liang/p/13037190.html
Copyright © 2011-2022 走看看