7

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.

11
  • 1
    When you say "boot time" do you mean host boot or guest boot?
    – Seth
    Nov 1, 2015 at 16:29
  • i mean guest boot
    – GeoMint
    Nov 1, 2015 at 16:30
  • @GeoMint Maybe not what you are looking for but why don't you turn on the "share clipboard option" in your virtualBox parameters?
    – Prolix
    Nov 1, 2015 at 16:30
  • I have already set share clipboard option to Bidirectional
    – GeoMint
    Nov 1, 2015 at 16:33
  • You run that command on the host in order to launch the VBox client and boot your VM, right? Why not just make VBoxClient an alias to sudo VBoxClient --clipboard?
    – terdon
    Nov 1, 2015 at 16:40

1 Answer 1

4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .