Not really - Lion is now able to kill processes that appear to be idle and unused. Fast user switching adds more load on memory and processor (due to the simple fact that more is now running), increasing the chance this will trigger.
Also, the changes to allow multiple simultaneous logins may have changed the API which will need the VPN client to request to stay connected or otherwise start itself outside the user space to survive a switch in Lion.
Well, I cracked it, it wasn't loginHooks I needed, but launchctl.
Basically, create two scripts (executable of course, you can make em root only too):
User1.sh
!/bin/bash ifconfig en0 up; ifconfig en1
down;
User2.sh
!/bin/bash ifconfig en1 up; ifconfig en0
down;
These of course make the assumption you're using an imac, en0 is the enthernet, en1 is the WiFi.
Then create a plist file (with root ownership, 644), mine was this:
User1's went in /Users/user1/Library/LaunchAgents/org.user1.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.user1.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Users/user1/bin/User1.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
User2's in /Users/user2/Library/LaunchAgents/org.user2.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.user2.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Users/user2/bin/User2.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
After that run
sudo launchctl load -w
/Users/user1/Library/LaunchAgents/org.user1.plist
and
sudo launchctl load -w
/Users/user2/Library/LaunchAgents/org.user2.plist
as each user.
That's it, it's quick, simple, and if you set the owner of the scripts as someone else (and on another path), it's fairly secure (not bulletproof, but that's not in my scope at the moment).
Best Answer
You can use Back to My Mac and access it there. There is a support question on Apple's website that explains how to set it up on both Macs. I should tell you that the requirements are as follows:
I forgot to mention that you should also check off the "Screen Sharing" and "File Sharing" boxes from System Preferences > Sharing.
Be sure that when you have enabled Back to My Mac in the iCloud settings in System Preferences, it should not have a yellow warning sign. If it does, click on it and follow the instructions there.
When both Macs have been set up, go to the Mac that you want to use to access the other and go to Finder. You should see the name of the computer there. Click on it.
You should see a bar with two icons: "Share Screen…" and "Connect As…". Click on "Connect As…". You should now see a box with a username field and password field. Type in the account that you wish to access and click "Connect." You should be able to access the files from there.