Linux SysAdmin & DevOps

Dropbox on CentOS 7 XFS with VeraCrypt

Dropbox - It was never on my favourite list because I’ve always used Google Drive. But since I didn’t want to use my Google Drive to store some specific files I’ve decided to give Dropbox a try on my CentOS 7 server.

Unfortunatelly, for some reason I was not able to make it work (the CLI). After a little bit of researching and googling, it seems that the latest version requires GLIBC version >= 2.19 while the default on CentOS 7.6 is 2.17. More, it seems that’s mandatory to have an EXT4 filesystem in order to sync the remote files locally. Apparently, with XFS, the files are never synced.

I was pretty close to just say a well deserved “Fuck you!” then it hit me. Docker! So why not running Dropbox inside a docker container better? As for the filesystem, which was already XFS and I had no intention to change that, I’ve decided to use VeraCrypt to create an encrypted EXT4 partition on my actual XFS filesystem.

So here’s how I did it:

1) Install Docker by following the official provided by Docker -> Install Docker.

2) Install VeraCrypt:

mkdir -p /usr/local/src/veracrypt
cd /usr/local/src/veracrypt
wget "https://launchpadlibrarian.net/388151497/veracrypt-1.23-setup.tar.bz2"
tar -xjvf "veracrypt-1.23-setup.tar.bz2"
rm veracrypt-1.23-setup.tar.bz2
./veracrypt-1.23-setup-console-x64

3) Create an encrypted VeraCrypt partition (I’ve chosen 5G, same as my account):

veracrypt --create /var/veracrypt_partition --size 5G

Then choose: 1) Normal, 1) AES, 1) SHA-512, 5) Linux Ext4

3) Create a system user, and a folder where to store the files and mount the veracrypt volume

useradd -uid 2019 user -d /home/user
mkdir /user
chown user:user /user -R
veracrypt -t /var/veracrypt_partition /user

4) Run Dropbox inside a docker container:

First create some useful system aliases for an easier usage experience:

alias dropbox="docker exec -it dropbox dropbox"
alias dropbox-start="docker run -d --restart=always --name=dropbox -v /user/Dropbox:/dbox/Dropbox -v /user/.dropbox:/dbox/.dropbox -e DBOX_UID=2019 -e DBOX_GID=2019 janeczku/dropbox"

Start the docker container:

dropbox-start

Check what’s the status of docker container:

dropbox status

Check the container logs:

docker logs dropbox -f

Authorize Dropbox (you’ll see a console message similar with: Please visit https://www.dropbox.com/cli_link_nonce?nonce=be63e281839916cde2ede5427726e1b1 to link this device.

Once you have visited that link, the sync will start

And that’s pretty much it!