SSH 连接到 VirtualBox

栏目: 服务器 · 发布时间: 7年前

内容简介:VirtualBox 的窗口用起来远不如 terminal 舒服,复制的命令等不能粘贴到 VirtualBox 的窗口中。所以,我就尝试了一下使用 SSH 连接到 VirtualBox,在这里与大家分享一下。镜像:ubuntu-16.04.5-server-i386.isoUbuntu 安装

VirtualBox 的窗口用起来远不如 terminal 舒服,复制的命令等不能粘贴到 VirtualBox 的窗口中。所以,我就尝试了一下使用 SSH 连接到 VirtualBox,在这里与大家分享一下。

镜像:ubuntu-16.04.5-server-i386.iso

安装 openssh-server

Ubuntu 安装

sudo apt-get -y update
sudo apt-get install openssh-server

CentOS 安装

sudo yum -y update
sudo yum install openssh-server

配置端口转发规则

1.打开 VirtualBox 点击 Settings,选择 Network,然后点击 Advanced。

SSH 连接到 VirtualBox

2.如下图所示,将本地 2222 端口流量转发到虚拟机 22 端口。

SSH 连接到 VirtualBox

免密登陆

直接运行下面命令,然后输入密码就完成免密登陆设置了。

ssh-copy-id -f -p '2222' username@127.0.0.1

测试一下.

ssh -p '2222' username@127.0.0.1

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

You Can Program in C++

You Can Program in C++

Francis Glassborow / John Wiley & Sons / 2006-7 / 406.80元

An interactive and fun way to learn C++, one of the most popular high-level programming languages for graphic applications This unique, hands-on approach to learning C++ makes t......一起来看看 《You Can Program in C++》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具