-5

Specifically I am looking for any CLI commands that can do the job.Two VM's exist on a server both are red hat linux based.Thank you

3 Answers 3

1

While the best way would be to use the network, like SSH, SCP, rysnc or NFS, there are ways to share files at the virtual host level between 2 VMs. However, this is typically harder to configure and more prone to errors. I would suggest a network approach for all but special use cases.

In VMware for example, you can setup a virtual disk and share it to the two VMs. However, you need to be very careful with how you do this - because most OSes will expect to have their own disk and have full control over it, and might behave unexpectedly when another VM modifies that disk.

Protocols like NFS take care of this for you, and NFS is a lot cleaner solution for this problem.

0
scp /path/to/file <othervm's ip>:/tmp/
6
  • 1
    Do you wanna really use ssh without ip??? Nov 3, 2016 at 13:21
  • Buddy actually my knowledge in this area is minimal.So plz feed me some info about it
    – bgv
    Nov 3, 2016 at 14:11
  • 1
    ssh uses tcp protocol, tcp is an ip based protocol. you can't make ssh connection without ip. Nov 3, 2016 at 14:12
  • k thank u but is there any way to transfer files other than using SSH??
    – bgv
    Nov 3, 2016 at 14:13
  • yes, nfs. en.wikipedia.org/wiki/Network_File_System It's also ip based. Nov 3, 2016 at 14:14
0

Well the whole point of VMs is to be able to isolate your running code. For example, you want to run two Apache instances but you don't want anything to be shared by them so you build two VMs and now you can run them in isolation on the same server (where the VMs run). So the only way to transfer files between VMs is by normal server file sharing mechanisms like scp or rsync or nfs mounted file systems or samba mounted file systems. Otherwise you are hacking the virtual machine environment. Maybe instead of running VMs you want to run something a little more hackable like containers or even a chrooted environment to "isolate" your running code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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