What I want to do is

  • Write a shell script to open terminal on 2 PCs simultaneously (the other PC being the guest OS (ubuntu) running on my virtualbox).

How can I achieve this for a start?

I will try to break it down.

Guest OS - Ubuntu 14.04

The network is configured as follows. I have a constraint that that there should be a bridged network. Plus I connect to the internet through a proxy server.

  • Adapter 1 -

    • attached to : NAT
    • adapter type : PCnet-Fast III
  • Adapter 2 -

    • attached to : Bridged Network
    • Name : wlan1
    • adapter type : PCnet-Fast III

Host OS - Ubuntu 14.10

  • I am trying to open the terminal ( gnome-terminal ) on my guest OS from the host OS.( which could be done through ssh if I am not wrong ).

  • After that I would move on to automating the opening of the terminal on it by running a bash script.

closed as too broad by jasonwryan, vinc17, jimmij, jordanm, Anthon Feb 22 '15 at 5:51

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This title is not descriptive, and the body of the message is not clear, either. Do you want to run an identical series of commands on two separate hosts? Or do you merely want a script which spawns e.g. two xterms running ssh instances to two different hosts? Do you really need help with ssh or do you want help with shell scripting? Please consult stackoverflow.com/help/how-to-ask – billyjmc Feb 22 '15 at 2:11
  • hey @billyjmc. I just edited the question. Hope I am explaining it better this time. I prefer the 'gnome-terminal'. Not sure about 'xterm'. And I just want the terminal to start in the guest OS – Tasdik Rahman Feb 22 '15 at 6:56

The question isn't very clear, but my best guess for what you're trying to do is connect to your VirtualBox using ssh. If this is the case, you only need a terminal opened from the computer you're on; to connect to the Ubuntu box, you don't need any "terminals" open. The odds are overwhelmingly good that your Ubuntu box is running sshd, which is the background process that listens for SSH connections coming in.

To connect to your VirtualBox from a terminal on your computer, you'll first need to make sure your PC knows what to do with your request. You'll have to configure port forwarding for your VirtualBox, which is described in the VB documentation but is obnoxiously obtuse. The trick is to go to your VirtualBox dashboard and edit the settings of your virtual machine: In "Settings," go to "Network," and make sure you're using the NAT option. This should allow you to click on the "Port forwarding" menu -- here, the simplest way to get going is likely to forward port 22 on the host to port 22 on the guest.

All this means is that whenever someone tries connecting to localhost on port 22, VirtualBox will recognize this connection and send it to port 22 on your Ubuntu machine. 22 is the port conventionally used to connect via SSH. The user name and password are probably both "vagrant"

From there, you can SSH to the box just like you would any other -- you didn't include what OS you're using, but searching for "SSH connection" and whatever you're using should help. Mac and Linux boxes have SSH built in, and for Windows, PuTTY is probably the easiest way to do it.

Anyway, is that what you were asking?

  • hey @rev_bird. Thanks for answering. I have just edited the question to make it more clear. And yes I wanted help with the ssh part. I can try the bash script after that. – Tasdik Rahman Feb 22 '15 at 6:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.