Friday, March 25, 2011

Editing files remotely

  1. See previous post about key exchange and get_source_machine
  2. Install FUSE and SSHFS.
  3. Ideally, mount the remote directories you're interested to the same path on your Mac. Most recently I've used:
    sshfs mihaip@snowberry.local:/D \
        /D \
        -oauto_cache,reconnect,volname=snowberry-mihaip
    
  4. Add the following to your .bashrc:
    bbedit() {
      source_machine=$(get_source_machine)
      for arg in "$@"
      do
        readlink -fn $arg
        echo -n " "
      done | xargs ssh mihaip@$source_machine /usr/local/bin/bbedit
    }