proxmox-usb-hotplug
This script monitor and plug any new USB device to running KVM hosted by a proxmox server.
Usage: proxmox-usb-hotplug [options] Hotplug any new Usb device to your proxmox Options: -V, --version output the version number --vmid <vmid> vmid will receive USB Devices, by default the first running VM having an hostpci0 --user <user> host to connect
configuration file
# username used to connect to proxmox API
username = root@pam
# password used to connect to proxmox API
password = prOxmOxp@sswOd
# host used to connect to proxmox API should always be localhost
host = 127.0.0.1
# the node name to used
# by default use the first node, if you are using a cluster you should give the cluster name
;node=proxmox
# deny an usb device
deny-usb=001c:100d
# deny an usb hub
# you should always deny USB hub to avoid a dual passthrough
deny-usb=1a40:0101
# Connect some device at startup recommanded for keyboard and mouse
# a keyboard
force-usb=258a:1006
# a mouse
force-usb=18f8:0f97
# not implemented yet.
; watch = 60
# unplug all existing device on script startup
# then reconnect all force-usb devices
flush = 1
# try to autodetect USB Hub to avoid dual passthrough
no-hub=1
sample
# on the dom0 echo password = myPassword > conf.txtecho flush = 1 >> conf.txtproxmox-usb-hotplug -c conf.txt
use as a service
/etc/usb-hotplug.conf
password = prOxmOxp@sswOd
deny-usb=001c:100d
deny-usb=1a40:0101
force-usb=258a:1006
force-usb=18f8:0f97
flush = 1
no-hub=1
proxmox-usb-hotplug.config.js
moduleexports = apps: name: "proxmoxUsbHotplug" script: "proxmox-usb-hotplug" args: "--config" "/etc/hotplug-usb.conf" watch: "/etc/hotplug-usb.conf"
chmod 600 /etc/usb-hotplug.confnpm install -g proxmox-usb-hotplugnpm install -g pm2pm2 install pm2-logrotatepm2 startup# read the instruction pm2 status proxmox-usb-hotplug.config.jspm2 save
TODO
- Deal with USB 3.x.
- auto detect current cluster name.