Use same host's keyboard shortcuts on VM to copy/paste text - virtual-machine

Does there exist a way to make copy/paste working into a virtual machine (not between the VM and the host) using the same keyboard shortcuts used by the host machine?
In practice in macOS (host) I use cmd+C and cmd+V, respectively to copy and paste, while working with the VMs I have always used shift+ctrl+C and shift+ctrl+V for these operations. My doubt is about if it is possible to set the use of cmd+C and cmd+V to copy and paste when I am into the VM.
I had not able to do this neither using Virtualbox nor with VMware Fusion.

Related

Can I run one WSL2 virtual machine instance on two system?

I'm new to the WSL2 and wondering if it's possible to run the same WSL2 ubuntu instance on both my desktop and laptop.
Now I am able to use wsl --export and wsl --import method to save and load the system to/from my portable hard drive. But these methods takes a long time.
I notice that wsl --import load a file named ext4.vhdx. Is there a way to load straightly from this file?
Update v2.0:
I was able to get a workaround and it works great.
Thanks to Booting from vhdx here, I was able to load straightly from my vhdx file on my portable hard disk. Windows track down its subsystem with regedit, So we can write our own(p.s: make sure to get BasePath right, it starts with "\\\\?", or you will not be able to access the subsystem' filesystem on your host system.):
Windows Registry Editor Version 5.00
[HKEY_USERS\【your SID here】\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{【UUID here】}]
"State"=dword:00000001
"DistributionName"="distribution name"
"Version"=dword:00000002
"BasePath"="vhdx folder path" 【 e.g. "\\\\?\\E:\\S061\\WSL\\ubuntu-20"】
"Flags"=dword:0000000f
"DefaultUid"=dword:000003e8
I suppose the best way to do this would be to store ext4.vhd on a network storage device accessible to both devices.
I have previosly mentioned how to move ext4.vhd. You can check that out here
Basically you need to export from one machine and import it while making sure the vhd file is configured for wsl to access from the network storage
Since this should *officially* not supported expect some performance hits
Another way would be to run WSL on one computer and ssh/remote desktop to it from another device on the network
I'm of the strong belief that sharing the same ext4 vhd between two VM's simultaneously would be a bad idea. See this and this Unix & Linux StackExchange, including the part about ...
note that sharing LVs/partitions on a single disk between the servers at the same time is NOT very safe. You should only access whole disks from any of the servers at one time.
However, as dopewind's answer mentioned, you can access the WSL instance on one computer (probably the desktop) from another (e.g. the laptop). There are several techniques you can use:
If you have Windows 10 Professional or Enterprise on one of the computers, you can enable Remote Desktop, which allows you to access pretty much everything on one computer from another. RDP ("Remote Desktop Protocol") even works from other devices such as an iPad or Android tablet (or even a phone, although that's a bit of a small screen for a "desktop"). That said, there are better, more idiomatic solutions for WSL ...
You could enable SSH server on the Windows 10 computer with the WSL instance (instructions). This may sound counterintuitive to some people, since Linux itself running in the WSL instance also includes an SSH server (by default). But by SSH'ing from (for example) your laptop into your desktop's Windows 10, you can then launch any WSL instance you have installed (if you choose to install more than one) via wsl -d <distroName>. You also avoid a lot of the network unpleasantness in the next option ...
You could, as mentioned above, enable SSH on the WSL instance (usually something like sudo service ssh start) and then ssh directly into it. However, note that WSL2 instances are NAT'd, so there's a whole lot more hackery that you have to do to get access to the network interface. There's a whole huge thread on the WSL Github about it. Personally, I'd recommend the "Windows SSH Server" option mentioned about to start out with, then you can worry about direct SSH access later if you need it.
Side note: Even though I have SSH enabled on my WSL instances, I still use Windows SSH to proxy to them, to avoid these networking issues.

Virtual Machine - Mouse/Keyboard events on Virtual Machine integrate with main machine

sorry for bad English. I have a virtual machine and there i installed a software that make some events.
But this events only happens on virtual machine.
Exist any possibility to this events works in my main machine? I mean, an integration between virtual machine and main machine, so when for example my software on virtual machine press "A" keyboard key, on MAIN machine also will happen a "A" press keyboard key?
Thanks
Depending on what you are using VMware, VirtualBox, etc , you will need to install the appropriate software on the guest, so you can enable features like, bi-directional copy paste etc.
Once you have this set up you can look up in internet the exact configuration for your hypervisor.
For example here is a working solution for VirtualBox.
VMWare have notoriously bad documentation, also I couldn't find similar feature for the VMPlayer or the workstation. Here is a link to get you started
Hope the links are helpful .

Is it possible to have Vagrant box running on USB?

I want to creatre portable dev environment inside a Vagrant box. But faced a problem with ssh key access rights. On some target machines I haven't got enough rights to change them. Is it possible to configure Vagrant to have access maybe only with password to make box fully rights-independent?
You can have vagrant box running from USB (I do that a lot and its nice to take hard drive with you and go on another computer and everything is running the same)
If you run VMWare provider, this is all set as all the vagrant file and the VM files are within the .vagrant directory from your project so just run Vagrant init and vagrant up within your USB and all the files are there, you can take the USB drive with you and connect to another computer running vagrant/VMWare and you're good
When you run VirtualBox provider, its a bit different as the vagrant files will be stored within your vagrant directory but your VM files will likely be stored with your My Documents folder.
You can overcome that by forcing VirtualBox to store the files on the USB as well - see this answer https://stackoverflow.com/a/36343325/4296747 to have multiple options how you can do that

How to enable copy paste from between host machine and virtual machine in vmware, virtual machine is ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I am trying to copy and paste from my pc to the vm but i cant.
I also enable copy and paste but i still can't copy and paste from my pc to the vm. My pc runs windows 8.1 my vm has fedora.
You need to install VMware Tools on your vm:
To install VMware Tools in most VMware products:
Power on the virtual machine.
Log in to the virtual machine using an account with Administrator or root privileges.
Wait for the desktop to load and be ready.
Click Install/Upgrade VMware Tools. There are two places to find this option:
Right-click on the running virtual machine object and choose
Install/Upgrade VMware Tools.
Right-click on the running virtual
machine object and click Open Console. In the Console menu click VM
and click Install/Upgrade VMware Tools.
Note: In ESX/ESXi 4.x, navigate to VM > Guest > Install/Upgrade
VMware Tools. In Workstation, navigate to VM > Install/Upgrade VMware
Tools.
[...]
Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1014294
This worked for me. Might want to try editing virtual machine settings:
Here is a small hint that I hope might be useful to other poor saps that experienced the same issue as I did.
My Setup:
Host: Windows 7 Enterprise - build 7601 SP 1
VM: VMware® Workstation 12 Player 12.1.1 build-3770994 (free)
Guest: Fedora release 23
I naively failed to install open-vm-tools-desktop. I say naively because I had no idea such a thing existed, nor do I understand why instructions to install open-vm-tools do not (or at least where I read them, do not) include mentions of this package.
Installing open-vm-tools on its own appears to be nearly useless - the desktop package makes the copy and paste function - probably the single most important function of VMTools - work.
So, there you go. Install open-vm-tools-desktop, and copy-paste should work
If your VM already came with VMware Tools pre-installed, but this still isn't working for you--or if you install and still no luck--make sure you run Workstation or Player as Administrator. That fixed the issue for me.
here is another solution I started using after being fed up with the copy and paste issue:
Download MRemote (for pc). this is an alternative to remote desktop manager. You can use remote desktop manager if you like.
Change the VMNet settings to NAT or add another VMNet and set it to NAT.
Configure the vm ip address with an ip in the same network as you host machine. if you want to keep networks separated use a second vmnet and set it's ip address in the same network as the host. that's what I use.
Enable RDP connections on the guest (I only use windows guests)
Create a batch file with this command. add your guest machines:
vmrun start D:\VM\MySuperVM1\vm1.vmx nogui
vmrun start D:\VM\MySuperVM2\vm2.vmx nogui
save the file to startmyvms.cmd
create another batch file and add your vms
vmrun stop D:\VM\MySuperVM1\vm1.vmx nogui
vmrun stop D:\VM\MySuperVM2\vm2.vmx nogui
save the file to stopmyvms.cmd
Open Mremote go to tools => External tools
Add external tool => filename will be the startmyvms.cmd file
Add external tool => filename will be the stopmyvms.cmd file
So to start working with your vms:
Create you connections to your VMs in mremote
Now to work with your vm
1. You open mremote
2. You go to tools => external tools
3. You click the startmyvms tool
when you're done
1. You go to tools => external tools
2. You click the stopmyvms external tool
you could add the vmrun start on the connection setting => external tool before connection
and add the vmrun stop in the connection settings => external tool after
Voilà !
Are you talking about drag and drop, when you say copy and paste?
If yes, you can also use Rightclick on object on your main computer and click copy. And then you go into the Virtual Machine and Rightclick the position where you want the file to get copied to.
If this doesn't work use the method KaiserM11 explained and get yourselfe VMware Tools like in this Video: https://www.youtube.com/watch?v=McjwI_6BKZY
Hope my answer was helpfull to you and happy coding :D
the mremote option offers more automation and almost replicates the vmware workstation graphical experience plus major benefits:
NO DPI (guest resolution) hassle
no copy pose hassle
Automation = starting vms and suspending them automatically
plus more if you look deeper
You need to install some packages such as Unlocker, GuestOSx, etc.

How do I make a hotkey to activate a specific VMware Workstation VM?

I'm using the latest version of VMware Workstation (11.1.0) on Windows 7 x64 and I want to be able to do a keystroke of "Ctrl + 1" to go to VM #1, "Ctrl + 2" to go to VM #2, and "Ctrl + 3" to go to VM #3.
Sounds simple right? It isn't.
On Mac OS X, achieving this functionality is trivial with VMware Fusion in combination with Spaces / Mission Control - you can simply put each VM on a separate space and then define whatever space hotkeys you want. I'm migrating from OS X and want this same functionality.
For reference, here are some potential solutions that I've tried and can verify that they don't work:
1) AutoHotkey
AutoHotkey can be used to make hotkeys like so:
^1::WinActivate, Win7(1) - VMware Workstation
^2::WinActivate, Win7(2) - VMware Workstation
^3::WinActivate, Win7(3) - VMware Workstation
These work to enter the VMs, but not to exit; Workstation will feed the "Ctrl + 1" to the VM and AutoHotkey does not take precedence, even if AutoHotkey is run as an administrator.
2) Suspend/Unsuspend with AutoHotkey
This promising post suggests that suspending and that unsuspending AutoHotkey while the VMware window is active will fix the problem:
https://superuser.com/questions/232762/autohotkey-script-to-exit-vmware-window
However, even after copying the exact code and making the necessary string modifications, I can't get it to work with Workstation.
3) Remote Desktop and/or VNC
One possible solution, if all 3 of the VMs in question were running Windows, would be to use Microsoft's Remote Desktop feature. However, one or more of the VMs that I intend to use will be running Linux.
On Linux, it is possible to just use VNC. However, VNC has considerable drawbacks when compared to the native VMware Workstation console window: there is no sound, the resolution won't automatically scale, the performance will be bad, and so forth.
Lastly, the VMs will be on 1) networks that won't be connected to the host via a bridged NIC (with the NIC disabled on the host) and 2) using a VPN without any split tunnel. So there will be no connectivity for either remote desktop or VNC in the first place.
3) A Windows Keyboard Hook
Liuk explains how to use a Windows hook to intercept keystrokes using C++:
http://polytimenerd.blogspot.com/2011/02/intercepting-keystrokes-in-any.html
However, after testing with the demo program, it seems that this method does not intercept keystrokes sent to VMware Workstation.
4) FullScreenSwitch.directKey
It seems that in VMware Workstation used to have this kind of functionality built in, as documented in this SuperUser thread:
https://superuser.com/questions/71901/vmware-workstation-keyboard-shortcut
However, VMware's documentations states that this is for VMware Workstation 5.0. I tried adding these strings to my VMX file and they had no effect, so the functionality must have been depreciated somewhere along the lines between Workstation 5 and 11.
5) PSExec
Wade Hatler mentions that he accomplishes this using PSExec to activate the appropriate AutoHotkey script on the host machine:
http://www.autohotkey.com/board/topic/64359-sending-keystrokes-to-vmware-player/
This solution is questionable in that you have to keep the password of your host machine in plaintext in order to pass it to PSExec.
Regardless, this solution will not work for the reasons also described in #2 above: the VMs in question will be on 1) networks that won't be connected to the host via a bridged NIC (with the NIC disabled on the host) and 2) using a VPN without any split tunnel. So there will not be guaranteed connectivity between the host and the guest.
6) Execute a "Host" keystroke between every "Ctrl + #" keystroke
This is problematic in that it doubles the amount of keystrokes involved and makes it impossible to "flip" through all of my VMs by holding down control and hitting 1 + 2 + 3 + 4 + 5, and so forth.
7) Use the "Host + Left/Right Arrow" hotkey and/or VMware-KVM.exe for cycling functionality
This is problematic in that when I have 10 or more VMs open at a time, rotating through all of them becomes incredibly cumbersome and inefficient.