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

  • 相关阅读:
    尘误解
    了解了解你自己的话zookeeper(从那时起,纠正了一些说法在线)
    HDU 5055 Bob and math problem(结构体)
    Linux通过编辑器vi使用介绍
    OCP-1Z0-051-名称解析-文章32称号
    刘强东:解密京东10甘蔗理论
    Android结构分析Android智能指针(两)
    hbase ganglia监控配置
    第一个位和一个真正的项目件
    Html5 の 微信飞机大战
  • 原文地址:https://www.cnblogs.com/music-liang/p/13037190.html
Copyright © 2011-2022 走看看