The goal is to sync a common directory structure over multiple sites.
useradd -g office -d /home/common -c "btsync service" -m btsync
/home/common
have primary group office
and umask=002
office
and prevent this changingchgrp -R office /home/common chmod g+s /home/common #just to top directory (assume no sub-directories) chmod -R g+w /home/common
office
it will be editable.mkdir -p /opt/bin #the place to put binaries that are not packaged-managed echo 'su btsync -c "umask 002; /opt/bin/btsync"' > /opt/bin/btsync.sh #run as user btsync. Must force umask here. # optionally append to the command: --config /etc/btsync.conf chmod 777 /opt/bin/btsync.sh ln -sfn /opt/bin/btsync.sh /usr/local/bin/btsync ln -sfn /opt/bin/btsync.sh /etc/init.d/btsync runlevel #find runlevel ln -sfn /etc/init.d/btsync /etc/rc3.d/S65btsync #for runlevel 3
su #if running on a server, else run as the user who will have access to synced files glibc=glibc23_ #for CentOS 5 or 6 arch=x64 # or i386 version=1.4.111 binary=$version/btsync_$glibc$arch-$version pkill btsync #stop process if this is an upgrade sleep 3 wget http://syncapp.bittorrent.com/$binary.tar.gz tar -zxf btsync* -C /opt/bin btsync rm -f btsync* chmod 777 /opt/bin/btsync /etc/init.d/btsync && ps -ef | grep btsync # make sure it is running under correct user
ssh root@server -L 8889:localhost:8888 -N browse: http://127.0.0.1:8889/gui
/etc/systemd/system/btsync.service
substituting username[Unit] Description=btsync running as myusername After=network.target [Service] Type=simple User=myusername ExecStart=/usr/bin/btsync --nodaemon [Install] WantedBy=multi-user.target
systemctl enable btsync.service
.SyncIgnore
but be very careful with it:
.SyncIgnore
, they will be synced back, but this is one way only./opt/bin/btsync --dump-sample-config > /etc/btsync.conf #create
.SyncIgnore