scp between two virtual machines in virtualbox - virtual-machine

I am currently running two virtual machines using virtualbox, one is an ubuntu 14.04 and the other one is a centOS7 on a redhat (64 bit) system. What I am trying to do is to write a shell script that simply copies a file to my centOS7 machine, I am running this script in my ubuntu machine and the file is on the Ubuntu virtual hard drive. I have so far set the IP in my CentOS7 to be static to xxx.xxx.xxx and the script is simply written as scp file_to_move username#xxx.xxx.xxx:/here/.
but it does not work I wonder is there something I need to configure in my virtualbox or is the script plain wrong?

1) Have you installed ssh-server on your ubuntu machine
2) Have you generated the public/private e.g. RSA keys pair to enable the batch usage of ssh client in your script
3) Have you properly configured the VirtualBox eth cards so that both your machines are in the same network (machines can ping one another)
...
As you can see there may be a lot of reasons why you cannot copy files between your machines and without additional environment information it is hard to say what is causing the issue in your case.

Related

QEMU Virtual Machine: Creating a shared folder between Windows 10 (host) and Solaris 2.7 (guest)

I was wondering if anyone could give me wisdom on how to create a shared folder between my host machine (running Windows 10) and the virtual machine I created in qemu which is running Solaris 2.7. I need a way to get files in and out of the VM.
I've managed to "plug in" a folder as a virtual drive into the VM, using
-drive file=fat:rw:[folder],bus=0,unit=1,if=scsi,format=raw,media=disk
in the VM invocation. Solaris sees this as a disk, but I'm unsure where to go from here. I can't seem to format it because I don't know the "disk" geometry (apparently Solaris was very particular about this). I tried mounting the unformatted drive in Solaris but it wasn't able to do that either. I even tried giving it an entry in /etc/vfstab to see if I could get it to automount, but that didn't work either.
Is there a different way I should be mounting it? Or is there a trick to getting Solaris to use this virtual drive? I'm also open to other alternatives people are aware of for transferring files in/out of my VM, but since Solaris 2.7 is a rather old operating system, things like networking (for example) aren't trivial to set up (and even basic things like ssh are missing).
Any help would be appreciated!

Need to install Firefox browser on Hortonworks Sandbox virtual machine (HDP 2.4) running in Virtual Box 5.0.16

I am new to Hadoop and the Big Data world...
I have installed the Hortonworks Sandbox VM in Virtual Box. It's working great...
Can someone tell me how to install Firefox within the VM? I need it to use NIFI
Thanks a lot for any help!
Installing a browser on the VM and using it through VNC will typically be very slow. The best option is to set up an SSH Tunnel and do a local forward. If you use the PuTTy ssh client on windows then you can follow the following instructions on setting up the local forward which will allow you to use your browser on the host operating system to connect to the NIFI instance running in your VM.

Ansible SSH Key Setup

I'm dipping my toes into Ansible and I'm having trouble configuring SSH keys.
I currently have two Ubuntu 14.04 VMs running and present in the Ansible hosts file.
I also have an extra VM which is being used for Ansible management.
I have created an SSH key on the management machine and 'ssh-copy-id' them to both of the Ubuntu 14.04 VMs.
Based on watching videos and following tutorials of Ansible configuration, I should now be able to run 'ansible instancegroupname -m ping' sequentially on both of the machines without having to enter a password.
However when running that command on the management VM, I am prompted to enter the SSH passphrase for the management VM itself, something I have not seen in the tutorial videos. It just seems to work for them?
Thanks guys.
This was solved by adding the ssh-key to the ssh-agent.

Ubuntu on VirtualBox and Rails server

I have Windows 7. Installed VirtualBox and Ubuntu 11.04 as guest OS.
Networking is done by NAT.
Everything is fine: I have internet on Ubuntu.
I can access Windows from Ubuntu by its ip.
But i can't access Ubuntu by it's ip which is shown by ifconfig.
I run rails on Ubuntu.
How can I solve this problem: connect to Ubuntu/Rails server on ort 3000 from my Windows?
By default, VirtualBox's NAT allows the virtual machine to access the Internet ; but doesn't allow the physical machine to access the Virtual one.
The simplest solution would be to use another networking setting than NAT, for your Virtual Machine -- for instance, bridge should work fine (your VM would be visible on your network, though).
Another solution would be to use port forwarding ; about that, this article might help : Howto Access via ssh a Virtualbox Guest machine.
I used to struggle with configuring a similar setup until I found Vagrant. Vagrant makes it very simple to setup, connect to and work with a Linux virtual machine. After Vagrant is configured you can just type vagrant ssh to enter the virtual machine and your account has automatic sudo rights and everything works as expected - you don't even have to deal with logging into the vm. The initial setup for ssh does look to be a little more work under Windows though as you need to configure Putty before you can connect.
There is a simple configuration file in Vagrant that you use to specify which ports from the VM you want forwarded to your machine using a syntax like:
config.vm.forward_port("rails", 80, 3000)
config.vm.forward_port("tomcat", 8000, 8080)
and everything is taken care of. Details are here
If, for example, you are using Rails and you start vagrant with the command vagrant up in your Rails project directory than that directory is available on the VM. Since it is the same shared directory between machines, any changes you make in your Rails project directory on your machine using your regular editor is seen on the VM also. This makes testing in other environments very easy.
Instructions for setting Vagrant up with Windows are here and a RailsCast about it is here. Note that Vagrant has nothing to do directly with Rails - you can use it for setup of any virtual machine environment you need.
In short, you can't.
It is a local host not a public domain therefore not publicly accessible outside of your virtualbox environment.
Maybe someone has a clever hack for this but why would you want to do this in the first place?
Your solution is to either use firefox to browse to your localhost within your virtualbox linux session or develop on windows.
Personally I work the other way round I run Ubuntu 11.04 and I have virtualbox installations of xp, 2,000, me, vista and 7 so I can test in different environments. Inevitably I end up sharing my project folder from Ubuntu so that I can run the project in whatever OS I am testing for.

syncing contents of virtual machines

I usually sync two computers (mac and linux) using rsync so that I can work on either machine. Is it also possible to sync virtual machines (running Windows XP, specifically) on both systems that have been created by VirtualBox? Probably not...?
You can probably do it with all kinds of routing rules and port forwarding, but what about having each VM use a shared folder that you are rsyncing? This way you can rsync through hosts as you normally do and the VMs will pick up and make changes since the folder is shared between host and guest.
You can try putting VM on Dropbox as well.. http://forums.dropbox.com/topic.php?id=6520