8

I use VirtualBox for using Ubuntu 15.04, and I run at guest

$ sudo VBoxClient --clipboard

every time I want to copy something from host to guest. Every time I mean once per bootup.

How I can make the command run with sudo at guest boot time?

I have already set Shared Clipboard to Bidirectional value at VirtualBox Settings.

GeoMint
  • 815

1 Answers1

5

A simple solution would be to give your user the right to run the command without entering a password and then adding it to the list of startup programs. First, run sudo visudo and add this line to the file (change geomint to your actual user name):

geomint ALL=NOPASSWD:/usr/bin/VBoxClient --clipboard

Then, use the tools provided by your desktop environment to add the command to your startup applications. Instructions for Unity can be found here.

Alternatively, do it manually. Create a file called ~/.config/autostart/VboxClipbvoard.desktop with the following contents:

[Desktop Entry]
Type=Application
Exec=sudo VBoxClient --clipboard
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=VBox clipboard
Name=VBox clipboard
Comment[en_US]=
Comment=

Now reboot, and it should work as expected.

terdon
  • 104,119