
My one-liner Linux Dropbox client - l_pan_
http://lpan.io/one-liner-dropbox-client/
======
lloeki
> Recently, the proprietary Dropbox Linux client dropped support for all Linux
> file systems except unencrypted ext4.

What the heck. Anyone has more information about that? Any announcement? And
why would it fail to work on an encrypted (LUKS?) ext4 FS when encryption
seemed to me to sit _below_ the filesystem (since AFAIK ext4 doesn't support
encryption itself)?

~~~
discordianfish
It's FUD. ext4 with LUKS, which is what pretty much everyone is using on a
desktop, is still working and the client supported.

~~~
pmlnr
No, it's not FUD. encrypted ext4 is encfs and ecryptfs, not xy on LUKs, and
yes, they did drop support.

~~~
pritambaral
Just FYI: Ext4 has file-level encryption built-in now [1, 2], so 'encrypted
ext4' is actually different from encfs and ecryptfs.

[1]:
[https://www.kernel.org/doc/html/v4.19/filesystems/fscrypt.ht...](https://www.kernel.org/doc/html/v4.19/filesystems/fscrypt.html)

[2]: [https://wiki.archlinux.org/index.php/ext4#Using_file-
based_e...](https://wiki.archlinux.org/index.php/ext4#Using_file-
based_encryption)

~~~
pmlnr
I didn't know this, that's new for me.

------
panzerklein
I setup Syncthing [1] to do the same for my vimwiki folder. It was
surprisingly easy, and doesn't require any external storage services. And it
can even automatically sync files without internet, over the local network.

[1] [https://syncthing.net/](https://syncthing.net/)

~~~
luckman212
I've used Syncthing and it's excellent. But for me, the lack of a mobile app
was a dealbreaker. Even though it's not open source, I switched to Resilio
Sync[1] (formerly known as btsync). It ticks all the other boxes, and just
works amazingly well. I want to support them so I sprang for the $20 one time
Pro license which adds selective sync and a few other nice features.

[1]
[https://www.resilio.com/individuals/](https://www.resilio.com/individuals/)

~~~
yorwba
Syncthing does have a mobile app
[https://f-droid.org/packages/com.nutomic.syncthingandroid/](https://f-droid.org/packages/com.nutomic.syncthingandroid/)

~~~
Operyl
For Android yes, but the GP is likely using iOS where no such client seems to
exist.

~~~
licebmi__at__
I used fsync when using I bought an apple device
[https://itunes.apple.com/us/app/fsync/id964427882](https://itunes.apple.com/us/app/fsync/id964427882)

It's lacking and has a weird workflow, but at least it worked for me. Didn't
test it too much as I hated the apple experience and gave away the device.

~~~
Operyl
The reviews would show you that it no longer works at all for iOS 12 and
beyond.

------
greatquux
Dropbox will work if you just create a local loopback file for an ext4
filesystem and mount the Dropbox folder on it.

~~~
algo646464
The above is a great answer.

To expand on this (from some googling). All of this requires root.

1) Create a sparse file (actual size depends on usage)

    
    
      truncate -s 100G /home/zzz/Dropbox.image
    

2) Create a ext4 filesystem on it

    
    
      mkfs.ext4 -m0 /home/zzz/Dropbox.image
    

3) Mount it as a loopback file system

    
    
      sudo mount /home/zzz/Dropbox.image /home/zzz/Dropbox-fs
    

4) Create / Copy your dropbox folder to Dropbox-fs

    
    
      sudo mkdir /home/zzz/Dropbox-fs/Dropbox
      sudo chown -R zzz.zzz /home/zzz/Dropbox-fs/Dropbox
      cp -r /home/zzz/Dropbox-original /home/zzz/Dropbox-fs/Dropbox
    

5) Start Dropbox and point it to the new location

6) If we want to mount this automatically at login. Adding it to /etc/fstab
may not work because of encryption.

But perhaps some script at login to mount it will work. For example, we can
create a script at /usr/local/bin/mountDB.sh and then add a line to
/etc/sudoers

    
    
      zzz ALL=(root) NOPASSWD: /usr/local/bin/mountDB.sh
    

Then somehow call this script at login of user zzz.

~~~
GordonS
I've never heard of a 'loopback filesystem' before. Can you expand a little on
what this is?

~~~
prewett
It lets you mount a file as a filesystem, instead of an actual hardware
device. I think it's called "loopback" because instead of reading from
/dev/whatever it loops back to /dev/original and reads the specified file.

See the man page for `mount`:
[https://linux.die.net/man/8/mount](https://linux.die.net/man/8/mount) (search
for "loop")

------
boulos
I hadn't seen entr before! My first glance at your one-liner:

find $ORG_DIR | entr -r rclone sync -v $ORG_DIR $REMOTE:org

is that find will enumerate all your existing files, but starting a new one
won't get picked up.

It seems like entr is prepared though, and you should just pass in -d. In fact
why use find at all, if you want to rsync the directory?

~~~
binaryapparatus
Huge additional plus, entr does not rely exclusively on inotify, it is also
'BSD kqueue wrapper. It is the only command line utility that I found that
allows cross platform (linux/BSD) scripting with file system events.

I have few scripts that rely on entr and I am always sure they are OS
agnostic.

~~~
lloeki
Then take a look at fswatch! (See sibling comment)

------
tssva
Since it is being used with systemd a systemd path unit could be used to
monitor the file system removing the need to use entr.

~~~
amenod
Thanks, didn't know systemd can do that [0]! I must grudgingly admit that it
seems to be quite useful, though I still don't like having a single app doing
all that stuff. But that's off topic... :)

[0]
[https://blog.andrewkeech.com/posts/170809_path.html](https://blog.andrewkeech.com/posts/170809_path.html)

~~~
tyingq
Both path units and entr use the inotify kernel API on Linux. If your needs
get more complex, there are python, perl, etc, APIs for the inotify libraries.

Also, if you have an older linux distro that predates inotify(), there's
similar functionality within auditd that will log changes to a file with a tag
of your choosing, then you can tail the file.

~~~
mixmastamyk
dnotify is another older one.

------
beagle3
.... Except, a file added to your dropbox will only appear in your local box
the next time you create a local file -- there is nothing to wake the local
entr when a file is remotely added to dropbox.

~~~
elliotec
Could write a little script to add then delete a temp file on some chron job
or at login or something.

~~~
beagle3
If I have a shared dropbox folder with someone, as soon as they put the file
in, I get a copy. There is no way to get a notification that would provide a
similar experience without the real dropbox client, afaik.

------
smilliken
Consider using git or another SCM instead. You don't need a centralized
server, you can push/pull between any two machines with ssh (or a handful of
other protocols). Encrypted end to end. Supports branches, useful for stuff
like dotfiles on different machines. You don't need commit messages, just make
an alias to add all changes and commit with and empty message. You have a full
history, can revert back to any state, inspect any old version, diff versions,
etc. There's git clients for mobile. Free as in beer and freedom. Check-
summed. Puts you in control of when to sync, supports offline. Future-proof,
acquisition-proof, VC-proof. Familiar.

~~~
cheez
I do this, but 90% of the time I forget to pull on the other machine and have
to deal with conflicts.

~~~
zipperhead
Yes, you'd have to automate the pull for this to work, and then you'd have a
way to notify on conflicts so that they are resolved ASAP.

Come to think of it, Dropbox isn't really so great at the notification aspect
of this either. It creates a 'conflicted' file but there is no notification
that I'm aware of. I have to remind myself to periodically check for
conflicts.

~~~
geofft
Is there a standard-ish git merge driver that resolves all merges with a
Dropbox-style "conflicted copy", so you can unconditionally git pull in a
cronjob and it never leaves the repo in an unmerged state?

------
stabbles
Not really the same, but this reminds me of the top comment of the Dropbox
announcement:
[https://news.ycombinator.com/item?id=8863](https://news.ycombinator.com/item?id=8863)

~~~
lewiscollard
Why does someone have to bring up this eleven-year-old comment any time file
synchronisation or Dropbox is mentioned?

Dropbox is now broken for certain Linux configurations and someone had a bit
of fun writing a shell one-liner to replicate some of its functionality.
Meanwhile, the original eleven year old comment was partly a throwaway remark
that it didn't do anything he could not do already which means it wasn't
interesting _to him_ (plus two other points, but nobody links to it for
those).

That's not even "not really the same", it's "and since you mentioned Dropbox,
let's make fun of BrandonM some more". It comes across as just mean-spirited
and shitty to me.

~~~
Dylan16807
> any time file synchronisation or Dropbox is mentioned

This is one of the most relevant topics you could quote it on, really. The
post is tackling _one-way_ sync and calling it a rough equivalent to Dropbox.

------
spatular
In that setup entr only watches files that existed when systemd service was
first started. So new files won't trigger backup. Something like this should
work:

while true; do find $ORG_DIR | entr -d -r rclone sync -v $ORG_DIR $REMOTE:org;
done

~~~
ISO-morphism
That's constantly polling the filesystem, isn't it?

I've never used it myself, but I know systemd has file watching built in. I
think using `PathModified=/path/to/org` would also eliminate the need for entr
[1].

[1]
[https://www.freedesktop.org/software/systemd/man/systemd.pat...](https://www.freedesktop.org/software/systemd/man/systemd.path.html)

~~~
spatular
It should re-poll only when a new file is added. In op's usage scenario it
won't be very ofthen.

The systemd solution may be even better, though it seems there is no way to
ignore changes in temporary files that emacs likes to create.

------
jfyne
It looks like there might be a bug. What happens when you add a new file? A
quick scan of the entr help text suggests you should be using the -d flag.

~~~
boulos
Ha! I took too long to format my response :). The entr examples from [1] seem
to do the same (ls *.rb for example).

[1] [http://eradman.com/entrproject/](http://eradman.com/entrproject/)

------
didip
The true workhorse behind this one-liner is inotify(Linux) or FSEvents(Mac)
API. Not sure what is the Windows equivalent.

If your favorite language has access to those, then you can basically build
your own file syncing client.

------
vanous
rclone is great, i have been using it to make backup of google photos. I had
tried so many different solutions before achieving this. Great to see it being
here on HN.

~~~
hv42
rclone is such a great tool indeed. This is almost the only viable approach
for transferring your data from one cloud to another. Huge thanks to the
creator and contributors!

------
ekianjo
It's kind of funny to replace a proprietary client for a proprietary service
with FOSS tools when you could completely replace Dropbox with FOSS
alternatives instead and enjoy Freedom: Syncthing works very well, and while
syncing is not its main feature you could also work with nextcloud.

~~~
rsync
If only there was a platform agnostic, standards-based, cloud platform that
you could point any old SSH tool at.

Imagine if such a provider existed _and_ was running on top of ZFS _and_
maintained the current, stable version of 'borg[1]' on the server side ...

Probably too much to ask.

[1] [https://www.stavros.io/posts/holy-grail-
backups/](https://www.stavros.io/posts/holy-grail-backups/)

~~~
ViViDboarder
Given the username, I’m assuming this is tongue-in-cheek because rsync.net is
pretty much that.

------
datafatmunger
I got one too, but syncs to ipfs/ipld and uses gpg for encryption.
[https://github.com/peerparty/fs2ipld/blob/master/fs2ipld.sh](https://github.com/peerparty/fs2ipld/blob/master/fs2ipld.sh)

------
mooreds
Previous discussion of entr:
[https://news.ycombinator.com/item?id=13856623](https://news.ycombinator.com/item?id=13856623)

------
shittyadmin
If you did want to run the original Dropbox client, you could likely make a
blob image on your encrypted partition, loopmount it and then sync to that.

------
dijit
I did something similar actually. I have my 1Password vault on Dropbox so I
can get it on my Linux machines.

Dropbox has some nice python modules/libraries to support me, so I’m able to
download the directory as a zip and extract it in memory.

It’s stupid and unidirectional, but I’m sure more talented people are able to
build a bidirectional python Dropbox client in no time, with inotify since
python has bindings for this too.

------
techntoke
rclone is great, but I find syncing manually in intervals to be ideal since
you get to see what is changing from your destination/remote. I use CrashPlan
Pro to back up everything automatically, and then a few times a week I'll run
rclone on my data drive so that I can see what has changed.

------
not_a_terrorist
You will be interested by this free and open source software: duplicati.com

------
therealidiot
Why does the client care which filesystem you use???

~~~
jeremysmyth
Different supported features make it easier to maintain such a client.
Example: Some filesystems notify observers on file change, some don't.

~~~
viraptor
This shouldn't affect other local filesystems though. Inotify won't work with
NFS, but should be ok with fs owned by the local system.

~~~
Spivak
The mistake is assuming that there's something special about 'local'
filesystems. They have as much feature disparity as networked ones.

------
amerine
This is cool. Thanks for sharing.

------
fouc
Wow, this is better than getting an FTP account, mounting it locally with
curlftpfs, and then using SVN or CVS on the mounted filesystem.

~~~
ilogik
reference acknowledged

[https://news.ycombinator.com/item?id=9224](https://news.ycombinator.com/item?id=9224)

------
saltybytes
This is _VERY_ cool but I stopped using dropbox and keep everything on my
self-hosted Nextcloud.

------
conanthe
Dropbox is a no no for one simple reason - there is no end to end encryption.
Unless I don't know something? I wouldn't want a disgruntled employee to
fiddle with my files.

~~~
whitepoplar
Is there any Dropbox-like service that lets you control your own private keys,
without resorting to the ugliness of uploading an encrypted image to Dropbox?

~~~
omnimus
Spider oak?

[https://spideroak.com/](https://spideroak.com/)

~~~
grumdan
It's important to note though that their client is not open-source, so if one
goes through all that trouble to use end-to-end encryption, it seems a bit
unsatisfactory to me to then trust this company to actually keep the private
keys on my machines (and encrypt things correctly).

Personally I used syncthing which doesn't do encryption but also only uses my
own devices, so I can keep the data on my machines at all times.

In the past I used seafile which does support encryption (and it's self-
hostable):
[https://www.seafile.com/en/home/](https://www.seafile.com/en/home/)

