Start VPN before Login

Got a problem with Viscosity or need help? Ask here!

Jondalar

Posts: 1
Joined: Fri Mar 27, 2009 6:55 pm

Post by Jondalar » Tue Jun 09, 2009 11:00 pm
Hi there,

I am wondering how I could manage to start Viscosity before my user logs in. Background - I am travelling an awful lot an sometime I would like to do maintenance for my iMac (like Systemupdates, etc) and these require a reboot. Since we (my wife and myself) share the iMac there is no autologin.

Is there a way anyone found to start the Viscosity Client before a user is logged in ? So I could use RemoteDesktop to log into the iMac after a reboot and log in as any user I configured?

What I found in several places are instructions to start openvpn2 via launchctl as a daemon on startup, but I doubt this will work with a GUI App like Viscosity (although I might be wrong here of course *grin*).

Anyone any thoughts on this?

Krgds,,
Alex

James

User avatar
Posts: 2313
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Sat Jun 20, 2009 10:55 pm
Hi Alex,

It's possible to get a GUI app to start up as a system service (aka Startup Item), from memory you just need to make sure it starts up last. For example, make sure it has the following in the StartupParameters.plist file:
Code: Select all
<key>OrderPreference</key>
<string>Last</string>
You should be able to find some information on how to create a Startup Item online. I've never tested it with Viscosity, but it can't hurt to try. Just follow a tutorial and use "/Applications/Viscosity.app/Contents/MacOS/Viscosity" as the path to the Viscosity binary.

Of course, a Startup Item runs as the root user (rather than your local account), so actually configuring Viscosity will be tricky. Probably the easiest option would be to enable root user login on the computer, log in as the root user, run Viscosity, and configure it (making sure to have it automatically connect your connection on launch). Or, you could configure it under your normal account, and copy the following files from your Library folder to the same locations in the root account's Library folder (which lives at /private/var/root/Library):

~/Library/Preferences/com.viscosityvpn.Viscosity.plist
~/Library/Application Support/Viscosity

Assuming all of the above is able to be done without a problem, Viscosity should then run it the background at all times.

Cheers,
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs

leonroy

Posts: 2
Joined: Mon Aug 17, 2009 8:01 pm

Post by leonroy » Mon Aug 17, 2009 8:06 pm
Hi Alex,

I often have to logon to my Mac using Directory authentication (and the password caching sometimes doesn't work leaving me unable to logon!). So to get Viscosity to connect to my office network before I logon with my user account I simply logon as a local throwaway account, connect to the office and then using Fast User Switching go back to the login window.

OpenVPN continues to run in the other user's account, and I am now connected to my office before I logon, a bit kludgy but since our office requires username/password authentication it's the only way afaik.
3 posts Page 1 of 1