栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

ssh连接VirtualBox中的CentOS

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ssh连接VirtualBox中的CentOS

如果有说错的地方希望大神指正

ssh连接VirtualBox中的CentOS

ssh连接VirtualBox中的CentOS

0.我的配置1.ssh-server2.虚拟机端口映射3.windows防火墙设置4.ssh连接 0.我的配置

VirtualBox6.1CentOS Stream release 8,安装时选择的是安装服务器(不需要图形化但也不是最小安装)

cat /etc/redhat-release

没有说用cmd或者powershell则都是在虚拟机中进行操作没有说用cmd或者powershell则都是在虚拟机中进行操作没有说用cmd或者powershell则都是在虚拟机中进行操作时间:2022/2/8 1.ssh-server

安装
查看ssh安装情况

rpm -qa | grep ssh

安装openssh-server

yum install openssh-server

配置

vim /etc/ssh/sshd_config

找到Port 22解注释
找到PermitRootLogin确认是yes

开启ssh查看ssh状态开机启动ssh

systemctl start sshd.service
systemctl status sshd.service
systemctl enable sshd.service

查看22端口,若出现LISTEN则已经开放监听,没有开放的话关掉防火墙试试

netstat -an | grep 22
2.虚拟机端口映射

VirtualBox>设备>网络>网络…>端口转发

如下添加一条配置,主机ip可以不填,子系统ip通过ifconfig获取

3.windows防火墙设置

管理员运行cmd或者powershell,都返回确定则成功

强制添加入站规则

netsh advfirewall firewall add rule name="SGAccessInboundRule" dir=in protocol=tcp action=allow localport=22

强制添加出站规则

netsh advfirewall firewall add rule name="SGAccessOutboundRule" dir=out protocol=tcp action=allow remoteport=22
4.ssh连接

在cmd或者powershell中ipconfig找到VirtualBox Host-only Network的IPv4地址

ssh root@IPv4地址

结束

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/731147.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号