傻瓜教程-vscode使用ssh连接虚拟机
vscode使用ssh连接虚拟机 傻瓜教程
- 检查是否能相互ping通
- 虚拟机安装ssh
- 本机vscode安装remote-ssh插件
- 配置公私钥
检查是否能相互ping通
在本机设置网卡为固定ip地址[以vmnet 1(仅主机模式,否则可能ping不通,建议新建网卡用于ssh连接)为例]
再在虚拟机中将对应的连接也设置为固定ip【注意要设置在同一网段,不然也是ping不通的】
【检验】
在本机命令行测试是否ping通
上面的结果就可以了,地址记得用自己设置的ip地址就好
虚拟机安装ssh
#安装
sudo apt-get install -y openssh-server
#启动
sudo /etc/init.d/ssh start
#检查服务是否启动成功
ps -e|grep ssh
同时,记得修改一下ssh的配置文件
ssh_config 文件内容如下:
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# 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
# 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 1hSendEnv LANG LC_*HashKnownHosts yesGSSAPIAuthentication yes
sshd_config内容如下
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying
#RekeyLimit default none# Logging
#SyslogFacility AUTH
#LogLevel INFO# Authentication:#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10PubkeyAuthentication yes# Expect .ssh/authorized_keys2 to be disregarded by default in future.
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM
本机vscode安装remote-ssh插件
如图进入配置文件设置
Host [link name] #连接名,可以自己定义HostName 192.168.75.5#虚拟机中的ip地址User [your name] #虚拟机中的用户名IdentityFile "C:\Users\asus\.ssh\id_rsa" #此条用于配置公钥私钥,免密登录,不用可以不写,后面是私钥地址
之后应该就可以连接了,如果连接不上,可以试试关闭对应adapter后重启
配置公私钥
如果本机没有公私钥,就先输入ssh-keygen
生成
参考来源
然后注意修改配置文件中的路径名identifyfile后面的内容,接着就可以免密登录了!
傻瓜教程-vscode使用ssh连接虚拟机相关推荐
- VScode使用SSH连接Linux(Ubuntu)系统程序开发,详细教程
VScode使用SSH连接Linux(Ubuntu)系统程序开发,详细教程 VScode使用SSH连接Linux(Ubuntu)系统程序开发 1.安装SSH 2.SSH连接远程服务器 3.远程编程开发 ...
- 关于VSCode用SSH连接OpenEuler
关于VSCode用SSH连接OpenEuler 1. 在VMWare中安装OpenEuler 下载iso文件 傻瓜式安装 2. 为VSCode安装Remote SSH拓展 3. 修改/etc/ssh/ ...
- ssh连接虚拟机中mysql_用SSH连接Vmware redhat虚拟机
我在winxp的虚拟机上装了一个redhat Enterpirse Linux 4的系统,winxp的ip为192.168.10.1,redhat的ip为192.168.10.130,使用NAT方式连 ...
- VSCODE配置SSH连接服务器
VSCODE配置SSH连接服务器 下载VSCODE 下载地址:https://code.visualstudio.com/ 如图所示 安装 安装时最好安装到D盘 配置 安装ssh插件 打开vscode ...
- VSCode使用ssh连接服务器跑代码
VSCode使用ssh连接服务器跑代码 1.VSCode安装插件remote-ssh 如图所示安装插件remote-ssh 2.连接服务器 2.1这时候VSCode左下角就会出现一个双向箭头,打开他 ...
- vscode通过ssh连接linux以及linux机之间的通信
本篇主要介绍VScode如何通过ssh远程连接服务器 第一步:在vscode应用商店安装Remote-ssh插件,如下图(界面上我的已经安装好了) 第二步:选择vscode的config文件,如下 第 ...
- 不能ssh连接ubuntu linux 服务器 secureCRT不能ssh连接服务器 不能远程ssh连接虚拟机的ubuntu linux...
我是用的是secureCRT,远程连接我的虚拟机里面的ubuntu 直接报错,连接不上 1,先分别在windows上ipconfig和ubuntu上ifconfig下 互ping一下,是可以ping通 ...
- 物理机Windows系统下使用SSH连接虚拟机Ubuntu
文章目录 所需环境 第一步:Ubuntu安装ssh服务器 第二步:Windows安装Xshell 第三步:互ping(因为ssh远程连接是通过网络连接的,如果网络都不通,就无法连接.) 实际操作 Ub ...
- 在Windows宿主机中ssh连接虚拟机CentOS中的Docker容器
1.拓扑图 2.前提条件 关闭虚拟机中的防火墙 在docker容器中安装并启用ssh服务 Windows宿主机与虚拟机CentOS网络互通(可通过Xshell连接) 虚拟机CentOS和Docker容 ...
最新文章
- Spring中WebApplicationContext
- 如何做好一场技术演讲-总结:3、如何把你的观点深深地刻在别人的脑海中?
- 动手动脑之接口与继承
- python100行代码-python代码行数统计 100行
- 电脑技巧:键盘失灵怎么办?
- linux网络编程 华清,Linux网络编程之套接字
- typescript 接口 java_Typescript基础(4)——接口
- mysql 查询事务信息_查看MySQL最近的事务执行信息
- Fedora core 2下建立Poptop服务器以及常见问题
- solve det(I + uv^t)
- SpringBoot 的事务管理
- Android中MVP框架理解
- 数据分析神器Alteryx
- 32位16进制转换为10进制数
- LA 3708 - Graveyard 墓地雕塑
- Papers with Code一个查找论文和对应代码的神器
- 论文文字公式怎么降重
- MLdonkey与sancho安装使用及设置详解
- VScode 简洁界面操作
- 质子交换膜燃料电池(PEMFC) Simulink模型 包括静态模型和动态模型(两个独立模型 可计算输出电压、输出功率、效率
热门文章
- 微型计算机原理及应用考研试题,计算机考研必备微型计算机原理及应用试题精选...
- 保障实施管理子系统业务流程操作说明
- Parsa‘s Humongous Tree
- 虚拟主机网站服务器失去响应怎么办,网站打不开的6种现象及解决方法
- Navicat Premium 连接服务器oracle 提示ORA-01017:用户名/口令无效;登陆被拒绝
- EasyDSS如何实现定期检测和取读加密狗授权?
- Linux fcntl 函数全解
- 啦啦外卖45.9全解+三端小程序,修复坑位正常使用截图预览
- Linux上安装LaTeX
- 零中频接收机频率转换图_大神告诉你WCDMA之Tx Leakage对于零中频接收机之危害