在Windows中通过SSH工具连接虚拟机中的Linux

  • 时间:2025-10-20 23:08 作者: 来源: 阅读:0
  • 扫一扫,手机访问
摘要:本文中使用的SSH工具是MobaXterm,Linux是深度操作系统(DeepinOS)。1、查看系统是否安装opensshdpkg -l | grep openssh-server此处已经显示笔者系统里安装了,如果没有任何输出显示就表明没有安装,通过命令sudo apt install openssh-server2、切换到目录/etc/ssh,使用vim

本文中使用的SSH工具是MobaXterm,Linux是深度操作系统(DeepinOS)。

在Windows中通过SSH工具连接虚拟机中的Linux


1、查看系统是否安装openssh

dpkg -l | grep openssh-server

在Windows中通过SSH工具连接虚拟机中的Linux


此处已经显示笔者系统里安装了,如果没有任何输出显示就表明没有安装,通过命令

sudo apt install openssh-server

2、切换到目录/etc/ssh,使用vim编辑器打开sshd_config配置文件,开启监听端口,监听地址。

主要的几句话需要放开,去掉#号。

sudo vim sshd_config
#将文件中,关于监听端口、监听地址前的 # 号去除Port 22AddressFamily anyListenAddress 0.0.0.0ListenAddress ::#然后开启允许远程登录PermitRootLogin yes#最后,开启使用用户名密码来作为连接验证PasswordAuthentication yes

下面是已修改好的,可以比照参考,可以使用ssh工具链接的的sshd_config配置文件。

Port 22AddressFamily anyListenAddress 0.0.0.0ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_keyHostKey /etc/ssh/ssh_host_ecdsa_keyHostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying#RekeyLimit default none# Logging#SyslogFacility AUTH#LogLevel INFO# Authentication:#LoginGraceTime 2mPermitRootLogin prohibit-password#StrictModes yes#MaxAuthTries 6#MaxSessions 10#PubkeyAuthentication 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

按Esc键,退出编辑模式,输入 :wq 回车,保存刚才编辑好了的文件。

3、开启sshd 服务,输入 命令

sudo service sshd start

4、检查 sshd 服务是否已经开启,输入命令

ps -e | grep sshd

在Windows中通过SSH工具连接虚拟机中的Linux


如果有输出显示说明已经启动。

5、查看Linux的IP

ifconfig

在Windows中通过SSH工具连接虚拟机中的Linux


6、在Windows中查看是否能连通Linux

ping 192.168.189.130

在Windows中通过SSH工具连接虚拟机中的Linux


7、用MobaXterm连接Linux

在Windows中通过SSH工具连接虚拟机中的Linux


在Windows中通过SSH工具连接虚拟机中的Linux


在Windows中通过SSH工具连接虚拟机中的Linux


出现以下画面说明已经成功连接上虚拟机中的Linux,只需输入用户名和密码,也就是你的Linux的登录名和密码。

在Windows中通过SSH工具连接虚拟机中的Linux


正确输入用户名和密码后,登陆成功

在Windows中通过SSH工具连接虚拟机中的Linux


  • 全部评论(0)
最新发布的资讯信息
【系统环境|】Ubuntu 25.04 + RTX 2080(8GB)用 vLLM 部署 Qwen3:8B(2025-10-20 23:52)
【系统环境|】程序员笔记:LINUX安装NVIDIA驱动程序(2025-10-20 23:51)
【系统环境|】ollama 部署和配置(2025-10-20 23:50)
【系统环境|】docker环境运行GPU算法基础环境搭建(2025-10-20 23:50)
【系统环境|】60块钱矿卡p106重新上岗玩大模型(2025-10-20 23:49)
【系统环境|】Ubuntu 安装 NVIDIA L20 显卡驱动(2025-10-20 23:48)
【系统环境|】Ubuntu 22.04 Tesla V100s显卡驱动,CUDA,cuDNN,MiniCONDA3 环境的安装(2025-10-20 23:47)
【系统环境|】显卡驱动安装后CUDA不可用?90%的人都踩过这3个坑(2025-10-20 23:46)
【系统环境|】一夜回到解放前——掀起“NVDLA”的盖头来(Nvidia刚发布的NVDLA是何方神圣?)(2025-10-20 23:45)
【系统环境|】一键提取歌曲伴奏和人声分轨,最强伴奏与人声分离工具(2025-10-20 23:44)
手机二维码手机访问领取大礼包
返回顶部