I want to keep a folder synced on several computers. First i started with OwnCloud.
There is a good howto to setup OwnCloud an a Qnap device here: http://wiki.qnap.com/wiki/Category:OwnCloud.
On my TS-410 the sync of a big folder was VERY slow, because it is PHP based and this generates a big CPU load an the
slow ARM device.
Therfore i tried SparkleShare which was fast compared to my OwnCloud test.
Here is the way i installed it:
Prepare the Client:
Download the SparkleShare client software from sparkleshare.org and install it.
After installation there is a "users link code.txt" in your SparkleShare which you copy to the NAS (to /share/Public in my example).
Server:
To setup the Qnap device as Server you need to install Git and configure a ssh keybased login.
The default ssh server only allows the user admin to login via ssh. This was good enough for me,
if you want to have SparkleShare for individual users install OpenSSh( http://wiki.qnap.com/wiki/How_…e_SSH_Daemon_With_OpenSSH)
Connect to your device via ssh
Then type
to install git. (It is necessary that the QPKG Optware is installed to run this command)
For the key-less login the Link Code in the Sparkle share folder has to be added to the authorized_keys file of
the login user. (admin aka root)
Then generate a share where the data should be located (in my example: /share/Git)
Repositories can be generated with dazzle.sh from the sparkleshare homepage.
Because of the restricted options of the NAS i stripped down the script to the necessary basics.
Copy the script to the NAS, with
you can generate a repository on the server.
#save me as dazzle.sh
#!/usr/bin/env bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
# Check if we're root, if not show a warning
if [[ $UID -ne 0 ]]; then
case $1 in
""|help) # You should be allowed to check the help without being
root
;;
*)
echo "Sorry, but Dazzle needs to be run as root."
exit 1
;;
esac
fi
GIT=`which git`
# Define text styles
BOLD=`tput bold`
NORMAL=`tput sgr0`
# Nice defaults
DAZZLE_USER="admin"
DAZZLE_GROUP="administrators"
DAZZLE_HOME="/share/Git"
show_help () {
echo "${BOLD}Dazzle, SparkleShare host setup script${NORMAL}"
echo "This script needs to be run as root"
echo
echo "Usage: dazzle [COMMAND]"
echo
echo " create PROJECT_NAME creates a SparkleShare project called PROJECT_NAME"
echo " create-encrypted PROJECT_NAME creates an encrypted SparkleShare project"
echo
}
create_project () {
if [ -f "$DAZZLE_HOME/$1/HEAD" ]; then
echo " -> Project \"$1\" already exists."
echo
else
# Create the Git repository
echo " -> $GIT init --bare $DAZZLE_HOME/$1"
$GIT init --quiet --bare $DAZZLE_HOME/$1
# Don't allow force-pushing and data to get lost
echo " -> $GIT config --file $DAZZLE_HOME/$1/config receive.denyNonFastForwards true"
$GIT config --file $DAZZLE_HOME/$1/config receive.denyNonFastForwards true
# Add list of files that Git should not compress
EXTENSIONS="jpg jpeg png tiff gif flac mp3 ogg oga avi mov mpg mpeg mkv ogv ogx webm zip gz bz bz2 rpm deb tgz rar ace 7z pak iso"
for EXTENSION in $EXTENSIONS; do
sleep 0.05
echo -ne " -> echo \"*.$EXTENSION -delta\" >> $DAZZLE_HOME/$1/info/attributes \r"
echo "*.$EXTENSION -delta" >> $DAZZLE_HOME/$1/info/attributes
sleep 0.05
EXTENSION_UPPERCASE=`echo $EXTENSION | tr '[:lower:]' '[:upper:]'`
echo -ne " -> echo \"*.$EXTENSION_UPPERCASE -delta\" >> $DAZZLE_HOME/$1/info/attributes \r"
echo "*.$EXTENSION_UPPERCASE -delta" >> $DAZZLE_HOME/$1/info/attributes
done
echo ""
# Set the right permissions
echo " -> chown --recursive $DAZZLE_USER:$DAZZLE_GROUP $DAZZLE_HOME"
chown --recursive $DAZZLE_USER:$DAZZLE_GROUP $DAZZLE_HOME
sleep 0.5
echo
echo "${BOLD}Project \"$1\" was successfully created.${NORMAL}"
fi
# Fetch the external IP address
IP=`curl --silent http://ifconfig.me/ip`
PORT=`grep "^Port " /etc/ssh/sshd_config | cut --bytes=6-`
# Display info to link with the created project to the user
echo "To link up a SparkleShare client, enter the following"
echo "details into the ${BOLD}\"Add Hosted Project...\"${NORMAL} dialog: "
echo
echo " Address: ${BOLD}ssh://$DAZZLE_USER@$IP:$PORT${NORMAL}"
echo " Remote Path: ${BOLD}$DAZZLE_HOME/$1${NORMAL}"
echo
echo "To link up (more) computers, use the \"dazzle link\" command."
echo
}
# Parse the command line arguments
case $1 in
create)
echo "${BOLD}Creating project \"$2\"...${NORMAL}"
create_project $2
;;
create-encrypted)
echo "${BOLD}Creating encrypted project \"$2\"...${NORMAL}"
create_project $2-crypto
;;
*|help)
show_help
;;
esac
Alles anzeigen
Now you should be able to connect to the NAS with your SparkleShare PC client.
The keys are stored on my NAS even if i reboot.