Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a production server off site and a development server as a virtualbox on my laptop.

My question is how do I setup virtualbox's network before booting the image so that I can SSH between the two?

(Google has a lot on this subject but it is usually people asking how they can ssh between the host and the client)

share|improve this question

migrated from Jun 2 '11 at 0:27

This question came from our site for professional and enthusiast programmers.

You set the networking adapter into bridged mode (virtual box settings). That's all.

If you want to be able to access your development server from the production server, you need to port-forward port 22 to your development computer/virtal box IP.

To access the file system on the production server, you can use scp to copy files back and forth. I wouldn't recommend it however, it's a pain in the ass.

I would recommend you sshfs.

The way sshfs works is, it mounts the remote file system in your local filesystem. Then you just open, edit, save, copy/paste files there, and sshfs does the scp data-transmitting stuff in the background.


sshfs /path/to/folder/where/you/want/to/mount/the/remote/filesystem


sshfs root@ /mnt/sshfs

PS: I would use ssh keys, not a password. Passwords are too weak.

To generate a key:

ssh-keygen -t rsa -b 4096

This generates id_rsa and you echo into the authorized_keys file in the .ssh folder in the home directory of the ssh user on the target machine

copy file to the target computer
cat ./ >> /root/.ssh/authorized_keys
share|improve this answer
what happens if I need to pull files from the production server onto the development (VB) server? – Sevenearths Jan 11 '11 at 15:42
I would mount the production server's file system as ssh file system. – Quandary Jan 11 '11 at 21:27
Note that you can omit user@ from user@ip if the user on the target machine corresponds to the user you're currently logged in with on the development machine. – Quandary Jan 11 '11 at 21:37
Maybe I should explain a bit more. – Sevenearths Jan 11 '11 at 23:38
I tried the bridge route but I just got ssh: connection to host port 22: Network unreachable. My setup is: router: - host: - guest: (vb/dev) and I let through 22 for on my router. What I find weird about all of this is I can still ssh from the host machine ( to the production server – Sevenearths Jan 11 '11 at 23:44

I found a way to ssh into the development server, but it wasn't with the command line so I don't know if this counts as an answer!

In my development (guest) OS, Cent OS, I can connect to my production server in the big wide world by going to:

Places > Connect to Server

and filling out the details as you would normally. (strangely when you select ssh it still asks you for the port you would like to use!?!)

Also. I don't know if this makes a difference but I entered the following into the host before booting the Cent OS image:

VBoxManage modifyvm "Cent OS 5.5" --natpf1 "guestssh,tcp,,22,,22"

recomended from here

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .