Proof of Concept: Chrooting SyncApp in Debian Squeeze (6)


crubb

Recommended Posts

Hey,

EDIT: Adapted for the "new" BitTorrent Sync.

finally got my invitation. As I am not really comfortable running closed-source binaries on my linux box, please find a proof of concept for running btsync in a chroot with it's own user below.

# useradd -m -s /bin/false btsync
# cd /home/btsync/

Download the latest *x64.gz and put it in /home/btsync

# wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_x64.tar.gz

Setup the chroot


# tar xfvz btsync_x64.tar.gz
# chmod u+x btsync

# mkdir dev etc lib lib64 proc sync tmp
# (cd dev; mknod random c 1 8; mknod urandom c 1 9)
# (cd etc; cp /etc/ld.so.cache /etc/resolv.conf /etc/nsswitch.conf /etc/localtime .; grep btsync /etc/passwd > passwd; grep btsync /etc/group > group)
# (cd lib; cp /lib/libpthread.so.0 /lib/libnsl.so.1 /lib/libdl.so.2 /lib/libnss_compat.so.2 /lib/libm.so.6 /lib/libc.so.6 /lib/librt.so.1 /lib/libnss_nis.so.2 /lib/libnss_files.so.2 .)
# cp /lib64/ld-linux-x86-64.so.2 lib64/

# mkdir -p usr/share/locale/
# cp /usr/share/locale/locale.alias usr/share/locale/
# mkdir -p usr/lib/locale/
# cp /usr/lib/locale/locale-archive usr/lib/locale/

# chown -R btsync:btsync /home/btsync

# mount -o bind /proc /home/btsync/proc

And run btsync

# chroot --userspec $(id -u btsync) /home/btsync ./btsync --config ./btsync.conf

Have fun!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.