Wednesday, November 02, 2011

Create a Desktop Shortcut to a VPN Connection

I connect to my Office's VPN all the time.  I don't like the multiple clicks required to do this (Click on your NETWORK ICON in the system tray, Click on VPN CONNECTION, then Click on "NAME OF YOUR VPN").  I want a simple desktop shortcut. To do this I needed to know the TERMINAL command to start and connect to a given VPN.  After some searching I found it!

nmcli con up id "NAME OF YOUR VPN"

If you type this into Terminal your VPN will connect!

So let's make a shortcut to do this for us with just one click (Ubuntu 11.04).

1. Right Click on your desktop

2. Select CREATE LAUNCHER

3. In TYPE set it to APPLICATION

4. In NAME type what you want to call this shortcut

5. In COMMAND copy and paste the following:

   nmcli con up id "NAME OF YOUR VPN"

6. Inside the quote marks replace NAME OF YOUR VPN with what you called your VPN connection when you created it. (mine is Main Office)

7. Add anything you want in COMMENT

8. Click Ok and your done!

NOTE: you can change the icon for your new VPN Shortcut by click on it (Picture of a spring) in the CREATE LAUNCHER window and browsing your hard drive for the icon of your choice.

BONUS NOTE:  You can create a VPN DISCONNECT shortcut by creating a new launcher and replacing the COMMAND (Operation 5 above) with:

nmcli con down id "NAME OF YOUR VPN"


This was done on Ubuntu 10.04 booting to the CLASSIC desktop.  I don't care for UNITY and have no idea if this will work there.

No comments: