用ssh连接的方式访问virtual-box里面的虚拟机

0 安装ubuntu-server时,software selection时按tab键选择openssh-server
1 添加.bash_aliases(clear,ll -h,为了使用方便,非必须,与ssh登录也毫无关系)
2 Append the following lines at the end of the file /etc/network/interfaces:
auto eth1
iface eth1 inet dhcp
3 vim  /etc/ssh/sshd_config,找到PasswordAuthentication no, 改为yes保存
4 sudo poweroff。
5 In VirtualBox Manager, choose the VM, then click the Settings button in the tool bar. This will invoke a window for VM configuration.   Select the Network category on the left.Select the Adapter 2 tab on the right.Enable "Adapter 2", and modify the Attached to attribute of Adapter 2 to Host-only Adapter. The Name attribute should become VirtualBox Host-Only Ethernet Adapter by default. Now launch the VM
6 sudo ifconfig eth1,You should see some information about the network interface "eth1"。现在可以用类似“inet addr:192.168.56.102”这里面的ip地址加速putty连接virtualbox虚拟机里面的ubuntu-server了

你可能感兴趣的:(ssh,ubuntu-server,ssh,virtual-box)