How to login into a VirtualBox session from the Display Manager in Linux.

This is a handy tip if you want to run a virtualbox server but dont want to have to login in as your user to run it or you want to reduce overhead on the host whilst using virtualbox. In this example Im using debian for both the host and guest and lightdm as the login manager, but setting this up should be very similar on other distro’s and login managers.

The first step is to make a small script to start the existing vm it, it should look like
#! /bin/bash
VirtualBox –startvm ‘Debian’

If your unsure of the name you can find out by using VBoxManage list vms. Make sure you save that in /usr/bin/ Im using /usr/bin/debian-vbox-session make sure you also make the script executable and has 755 perms, this can be done with sudo chmod +x /usr/bin/debian-vbox-session && sudo chmod 755 /usr/bin/debian-vbox-session if you called the script something else obviously change debian-vbox-session to what yours is.

Next step is to create a launcher for your display manager should look similiar to
[Desktop Entry]
Name=Debian
Exec=/usr/bin/debian-vbox-session

Save it to /usr/share/xsessions/ so for me I am saving it as /usr/share/xsessions/debain-vbox. Now if you logout there should be an options under ‘sessions’ for Debian. Keep in mind that only your user would have access to virtual machine so other users will not be able to log into a virtualbox session unless you give them access or create another virtualbox session for them to login as.

Advertisements
Tagged with:
Posted in 01Ben, Computers, Interesting, Linux, Virtual Box

Please feel free to leave a reply.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 68 other followers

%d bloggers like this: