Score:0

How to enable / disable VRDP access to VirtualBox VM regardless of state

cn flag
Rub

In the documentation https://www.virtualbox.org/manual/ch07.html

they tell you that you can use

$ VBoxManage modifyvm VM-name --vrde on

but that only works if the VM is off.

Can it be done while the VM is on? How?

--

Glossary:

RDP: Remote Desktop Protocol

VM: Virtual Machine

VRDE: VirtualBox Remote Desktop Extension

Score:0
cn flag
Rub

Yes.

Listing vms (to get the name)

$ VBoxManage list vms
"Debian_11_Server_64bit" {3d**6e14-3846-4673-aacb-726****283af}
"emptyVM" {8a**643a-f470-4ab0-931a-5da6****5ce4}

- Enable/disable VRDP when the VM is OFF

# Power off
$ vboxmanage controlvm emptyVM   poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

# Turn off VRDP
$ VBoxManage modifyvm emptyVM --vrde off

# Turn on VRDP
$ VBoxManage modifyvm emptyVM --vrde on

- Enable/disable VRDP when the VM is ON (or OFF)

# We start the VM
$ vboxmanage startvm emptyVM  --type headless
Waiting for VM "emptyVM" to power on...
VM "emptyVM" has been successfully started.

# Try the previous command
$ VBoxManage modifyvm emptyVM --vrde on
VBoxManage: error: The machine 'emptyVM' is already locked for a session (or being unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 640 of file VBoxManageModifyVM.cpp

The VRDP settings cannot be changed with "modifyvm" when the VM is ON.

But we can still change them with "controlvm".

$ VBoxManage controlvm emptyVM vrde off

$ VBoxManage controlvm emptyVM vrde on

- How can I know if it is enabled / disabled and the port?

$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE:                        enabled (Address 0.0.0.0, Ports 3394, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port:                   3394
VRDE property               : TCP/Ports  = "3394"
VRDE property               : TCP/Address = <not set>
VRDE property               : VideoChannel/Enabled = <not set>
VRDE property               : VideoChannel/Quality = <not set>
VRDE property               : VideoChannel/DownscaleProtection = <not set>
VRDE property               : Client/DisableDisplay = <not set>
VRDE property               : Client/DisableInput = <not set>
VRDE property               : Client/DisableAudio = <not set>
VRDE property               : Client/DisableUSB = <not set>
VRDE property               : Client/DisableClipboard = <not set>
VRDE property               : Client/DisableUpstreamAudio = <not set>
VRDE property               : Client/DisableRDPDR = <not set>
VRDE property               : H3DRedirect/Enabled = <not set>
VRDE property               : Security/Method = <not set>
VRDE property               : Security/ServerCertificate = <not set>
VRDE property               : Security/ServerPrivateKey = <not set>
VRDE property               : Security/CACertificate = <not set>
VRDE property               : Audio/RateCorrectionMode = <not set>
VRDE property               : Audio/LogPath = <not set>
VRDE Connection:             not active

- How can I change the PORT

$ vboxmanage controlvm emptyVM  vrdeport 12345

- Does the change done with "controlvm" persist when the VM is powered off?

Below we poweroff the VM, disable VRDP, poweron, modify VRDP, poweroff and check. Apparently, the change is persistent.

$ vboxmanage controlvm emptyVM   poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

$ VBoxManage modifyvm emptyVM --vrde off

$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE:                        disabled

$ vboxmanage startvm emptyVM  --type headless
Waiting for VM "emptyVM" to power on...
VM "emptyVM" has been successfully started.

$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE:                        disabled
VRDE Connection:             not active

$ vboxmanage controlvm emptyVM  vrde on vrdeport 12345

$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE:                        enabled (Address 0.0.0.0, Ports 12345, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port:                   12345
VRDE property               : TCP/Ports  = "12345"
VRDE property               : TCP/Address = <not set>
VRDE property               : VideoChannel/Enabled = <not set>
VRDE property               : VideoChannel/Quality = <not set>
VRDE property               : VideoChannel/DownscaleProtection = <not set>
VRDE property               : Client/DisableDisplay = <not set>
VRDE property               : Client/DisableInput = <not set>
VRDE property               : Client/DisableAudio = <not set>
VRDE property               : Client/DisableUSB = <not set>
VRDE property               : Client/DisableClipboard = <not set>
VRDE property               : Client/DisableUpstreamAudio = <not set>
VRDE property               : Client/DisableRDPDR = <not set>
VRDE property               : H3DRedirect/Enabled = <not set>
VRDE property               : Security/Method = <not set>
VRDE property               : Security/ServerCertificate = <not set>
VRDE property               : Security/ServerPrivateKey = <not set>
VRDE property               : Security/CACertificate = <not set>
VRDE property               : Audio/RateCorrectionMode = <not set>
VRDE property               : Audio/LogPath = <not set>
VRDE Connection:             not active

$ vboxmanage controlvm emptyVM   poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

$ vboxmanage showvminfo emptyVM | grep VRDE
VRDE:                        enabled (Address 0.0.0.0, Ports 12345, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE property               : TCP/Ports  = "12345"
VRDE property               : TCP/Address = <not set>
VRDE property               : VideoChannel/Enabled = <not set>
VRDE property               : VideoChannel/Quality = <not set>
VRDE property               : VideoChannel/DownscaleProtection = <not set>
VRDE property               : Client/DisableDisplay = <not set>
VRDE property               : Client/DisableInput = <not set>
VRDE property               : Client/DisableAudio = <not set>
VRDE property               : Client/DisableUSB = <not set>
VRDE property               : Client/DisableClipboard = <not set>
VRDE property               : Client/DisableUpstreamAudio = <not set>
VRDE property               : Client/DisableRDPDR = <not set>
VRDE property               : H3DRedirect/Enabled = <not set>
VRDE property               : Security/Method = <not set>
VRDE property               : Security/ServerCertificate = <not set>
VRDE property               : Security/ServerPrivateKey = <not set>
VRDE property               : Security/CACertificate = <not set>
VRDE property               : Audio/RateCorrectionMode = <not set>
VRDE property               : Audio/LogPath = <not set>
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.