+ fi
+
+ ssh -o PreferredAuthentications=publickey $rdiff_host -l $rdiff_user "exit" 2> /dev/null
+ if [ $? -ne 0 ]; then
+ echo "Copying root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host. When prompted, specify the password for user $rdiff_user@$rdiff_host."
+ ssh-copy-id -i /root/.ssh/id_[rd]sa.pub $rdiff_user@$rdiff_host
+ if [ $? -ne 0 ]; then
+ echo "FAILED: Couldn't copy root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host."
+ ssh $rdiff_user@$rdiff_host 'test -w .ssh || test -w .'
+ result=$?
+ echo "Hit return to continue."
+ read
+ case $result in
+ 0 ) msgBox "$rdiff_title: error" "Directories are writable: Probably just a typo the first time." ;;
+ 1 ) msgBox "$rdiff_title: error" "Connected successfully to $rdiff_user@$rdiff_host, but unable to write. Check ownership and modes of ~$rdiff_user on $rdiff_host." ;;
+ 255 ) msgBox "$rdiff_title: error" "Failed to connect to $rdiff_user@$rdiff_host. Check hostname, username, and password. Also, make sure sshd is running on the destination host." ;;
+ * ) msgBox "$rdiff_title: error" "Unexpected error." ;;
+ esac
+ return
+ else
+ echo "Done. hit return to continue"
+ read
+ fi
+ else
+ echo "root@localhost is already in authorized_keys of $rdiff_user@$rdiff_host."
+ echo "Hit return to continue."
+ read
+ fi
+
+ # test to see if the remote rdiff backup directory exists and is writable
+ echo "Testing to see if remote rdiff backup directory exists and is writable"
+ ssh $rdiff_user@$rdiff_host "test -d ${rdiff_directory}"
+ if [ $? = 0 ]; then
+ ssh $rdiff_user@$rdiff_host "test -w $rdiff_directory"
+ if [ $? != 0 ]; then
+ msgBox "destination directory is not writable!" "The remote destination directory is not writable by the user you specified. Please fix the permissions on the directory and then try again."
+ remote_status=failed
+ fi
+ else
+ booleanBox "Remote directory does not exist" "The destination backup directory does not exist, do you want me to create it for you?"
+ if [ $? = 0 ]; then
+ ssh $rdiff_user@$rdiff_host "mkdir -p ${rdiff_directory}"
+ result=$?
+ case $result in
+ 0) msgBox "$rdiff_title: success" "Creation of the remote destination directory was a success!";;
+ 1) msgBox "$rdiff_title: error" "Connected successfully to $rdiff_user@$rdiff_host, but was unable to create the destination directory, check the directory permissions."
+ remote_status=failed;;
+ 255) msgBox "$rdiff_title: error" "Failed to connect to $rdiff_user@$rdiff_host. Check hostname, username, and password. Also, make sure sshd is running on the destination host."
+ remote_status=failed;;
+ *) msgBox "$rdiff_title: error" "Unexpected error."
+ remote_status=failed;;
+ esac
+ fi
+ fi
+
+ if [ "$remote_status" = "ok" ]; then
+ do_rdiff_con
+ fi