请问老师,使用vagrant安装好centos后,视频是使用vagrant ssh进入虚拟机,如何用xshell之类的客户端进行访问

来源:2-5 Vagrant&VirtualBox for Windows

suhaoyuan

2018-04-06

写回答

2回答

麦兜搞IT

2018-04-06

这个 有点复杂,我已mac为例

➜ virtualboxgit:(master)pwd
/Users/penxiao/Vagrant/centos7/docker-k8s-devops/chapter11/.vagrant/machines/gitlab/virtualbox
➜ virtualboxgit:(master) vagrant port gitlab
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
    22 (guest) => 2222 (host)
➜  virtualbox git:(master) ls
action_provision action_set_name  creator_uid      id               index_uuid       private_key      synced_folders   vagrant_cwd
➜  virtualbox git:(master) ssh -i private_key -p 2222 vagrant@127.0.0.1

Last login: Fri Apr  6 05:48:37 2018 from 10.0.2.2

[vagrant@gitlab ~]$

[vagrant@gitlab ~]$

[vagrant@gitlab ~]$


0
1
suhaoyuan
好的,谢 谢老师,现在可以了,用secureCRT可以方便clone session
2018-04-06
共1条回复

麦兜搞IT

2018-04-06

vagrant默认没法通过用户名密码登陆,而是通过SSH key。

找到这台机器的private key,然后通过vagrant port 找到它ssh端口转发在本地的端口号,然后就可以ssh了,当然也可以使用xshell或者secureCRT,putty等客户端登陆了。

但是也不是很方便,不如使用vagrant ssh来的简单

0
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1896 问题

查看课程