SSH with virtualbox, how to?

11.3k views Asked by At

I have a bitnami-wordpress virtual machine running on windows 7. I'm trying to set up a SSH server to access files in the virtual machine.

  1. I used this video as reference ; SSH guide. my network preference is bridged

  2. Then I login into my bitnami-wordpress, at this point I can access my Wordpress page. I then installed the ssh package with this command. this wasn't in the video but it was instructed by my lecturer

sudo apt-get install openssh-server

  1. I run putty and enter the host name as my virtual ip, 192.168.1.123, port 22, connection type SSH.

Putty refused to connect unfortunately. This was the log

2016-12-17 10:17:20 Looking up host "192.168.1.123"

2016-12-17 10:17:20 Connecting to 192.168.1.123 port 22

2016-12-17 10:17:20 We claim version: SSH-2.0-PuTTY_Release_0.67

2016-12-17 10:17:21 Failed to connect to 192.168.1.123: Network error: >Connection refused

2016-12-17 10:17:21 Network error: Connection refused

Still not sure what I missed, would appreciate any inputs

EDIT

added ipconfig results from my windows system: ipconfig

3

There are 3 answers

2
amirb On

You need to actually start the SSH server by invoking the following command:

sudo service ssh start

Also make sure sure that there is no firewall blocking network between client and server.

0
Silvio Fernandez On

The best way to login to a guest Linux VirtualBox VM is port forwarding. If you are using aninterface which is using NAT, if not you can change it easily. Then go to the Network settings and click the Port Forwarding button. Add a new Rule:

Host port 4422, guest port 22, name ssh, other left blank. or from command line

VBoxManage modifyvm SERVER --natpf1 "ssh,tcp,,4422,,22" where 'SERVER' is the name of the created VM. Check the added rules:

VBoxManage showvminfo SERVER | grep 'Rule' That's all! Please be sure you don't forget to install an SSH server:

sudo apt-get install openssh-server To SSH into the guest VM, write:

ssh -p 4422 [email protected] Where user is your username within the VM.

0
Ignacio On

The best way to mitigate this "issue" is to check:

  1. sshd daemon is running on linux box (in general openssh is installed but for security measures the service is not loaded)
  2. open ports (firewall-cmd or with ufw)

In case you want to ssh from host -> guest or guest -> guest then check that at least you have configured a Bridged network on VBox and not a NAT.