For the love of a command lines

I love having remote access to my Mac at home. Today I decided I wanted a bunch of James Bond theme music so the command line came to the rescue!

1. Tunnel AFP (Apple File Protocol) over SSH

`ssh -l USERNAME -L 10548:127.0.0.1:548 your.remote.host.tld`

2. Switch to the Finder and mount the remote share

afpScreenShot.png

3. Enjoy!

This will mount the drive on your local desktop, tunneling the AFP data over a SSH connection, something most firewalls safely allow.

Bonus command line action: you can remotely (and safely) quit a GUI app using AppleScript

`osascript -e ‘tell application “YourAppName” to quit’`

It’s a result of the OSA and the fact that Apple still supports AppleScript after all of the years.