Created
May 10, 2017 22:43
-
-
Save blole/09b48aafa0899475aa7c8bed8f098b3e to your computer and use it in GitHub Desktop.
Connect local CrashPlanDesktop to remote CrashPlanService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Connect a local CrashPlanDesktop to a remote CrashPlanService. | |
# Practically an automation of the steps to open an ssh tunnel and | |
# modifying .ui_info as described in | |
# https://support.code42.com/CrashPlan/4/Configuring/Using_CrashPlan_On_A_Headless_Computer | |
# | |
# | |
# For use from a windows computer with cygwin. Must be run with | |
# admin rights because the .ui_info file must be admin owned. | |
local_port=4200 | |
[email protected] | |
ufo="/cygdrive/c/ProgramData/CrashPlan/.ui_info" | |
# this is to be able to close the ssh tunnel again | |
# https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing#Setting_Up_Multiplexing | |
ssh_control_master_file="~/.ssh/controlmasters/crashplan" | |
set -e | |
function cleanup { | |
# close tunnel and restore .ui_info | |
set +e | |
echo "closing ssh tunnel and restoring .ui_info" | |
ssh -S $ssh_control_master_file $remote -O stop | |
mv $ufo.bak $ufo | |
} | |
trap cleanup EXIT | |
mkdir -p $(dirname $ssh_control_master_file) | |
cp -n $ufo $ufo.bak #don't overwrite | |
echo "copying remote .ui_info" | |
scp -q $remote:/var/lib/crashplan/.ui_info $ufo | |
remote_port=$(egrep -o '^[0-9]*' $ufo) | |
sed -i "s/^[0-9]*/$local_port/" $ufo | |
echo "opening ssh tunnel" | |
ssh -MS $ssh_control_master_file $remote -fNL $local_port:localhost:$remote_port | |
"/cygdrive/c/Program Files/CrashPlan/CrashPlanDesktop.exe" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment