6 ms·
Show HN: Sshync – Auto-sync files over SSH
- adontz 11y agoOn Windows I use WinSCP, from menu "Commands\Synchronize" and "Commands\Keep Remote Directory up to Date", or from scripting "synchronize" and "keepuptodate".
- pandada8 11y agoWhat's difference between this one and rsync?
- deleted 11y ago[deleted]
- alcoholiday 11y agoJavascript! And fewer features. (but a cool little project none the less!)
- smokemeth247 11y agorsync is not written in a hipster language.
- chisleu 11y agoThis is 130 lines of code, including whitespace.
- deleted 11y ago[deleted]
- stephenr 11y agoPlus node, and npm. That's an extra 59 packages from Apt. before you install this tool.
- chisleu 11y agoSo we will roll glibc and everything else into the counts too? My point was it isn't "hipster" to use something that is fast and efficient.
- stephenr 11y agoWriting yet another file sync solution using nodejs of all things is definitely hipster. Glibc is used by multiple packages. I simply identified the number of dependencies to install this tool when nodejs/npm are not installed.
- chisleu 11y agohttps://github.com/mattijs/node-rsync https://github.com/mattijs/node-rsync You can use rsync if you like too
- LukeShu 11y agoIt looks to me that this keeps running "in the background" and watches for changes; syncing things as they happen. Rsync can't do that.
- lawl 11y agoTrue but you could spawn rsync with a different tool that uses inotify, for example: http://git.quitesimple.org/adhocify/tree/README http://git.quitesimple.org/adhocify/tree/README
- vidarh 11y agorsync can however take a file list, and inotifywait can produce a file list with the help of awk or sed. Which means you can achieve continuous synchronisation with ~5 lines of shell script. A bit more care if you want to sync two ways. I've found that my file syncing needs tends to be so varied that most of the dedicated tools I've looked at have almost always been just wrong enough not to be worth it compared to just composing something with rsync and inotifywait. Of course your mileage will vary.
- megalodon 11y agoQuoting beagle3 > this one is continuous and rsync is one-shot.
- david_p 11y agothis works on windows
- ion201 11y agorsync can be run in cygwin.
- yaur 11y agoI use lsyncd for this. Why would I switch?
- aurelianito 11y agoMe too. Lsyncd rules! I use it to edit locally and run the code in an AWS instance. I even wrote something about it in my blog. http://aurelianito.blogspot.com.ar/2014/12/mejorando-el-mirroring.html?m=1 http://aurelianito.blogspot.com.ar/2014/12/mejorando-el-mirr...
- roeme 11y ago(We do as well). From what I see, the only advantage this offers over lsyncd is that Windows is supported.
- deleted 11y ago[deleted]
- aurelien 11y agoMaybe because lsyncd have nothing update from a year https://github.com/axkibe/lsyncd https://github.com/axkibe/lsyncd
- stephenr 11y agoThis project relies on the npm module "ssh-client" which is at v0.0.1 and hasn't been updated for three years. Want to compare any other useless statistics?
- felipellrocha 11y agoI pronounced this 's-shync' in my head. I am happy.
- beagle3 11y agoThis is a nice little project, but I think rsync is better suited for any serious use. It can do ssh, it's own protocol or any connection program that would tunnel bidirectionally. It does very efficient transfer, can create off-line patch files, and basically do any one-way file/dir sync function you can think of. Edit: this one is continuous and rsync is one-shot. Personally, I've been using inotify+rsync+timeout (intofy+rsync has a race condition, so limiting the inotify wait and syncing anyway is essential). Does sshync avoid the race?
- roeme 11y agoIf you're considering replacing your current (assumedly homegrown) solution; I'd recommend using lsyncd instead.
- ultramancool 11y agoYou might also check out Syncany if you're interested in client-side encryption or Syncthing if you're looking for something more Bittorrent Sync like.
- mynegation 11y agoI use similar solution: my own shell script with inotify + timeout + unison over ssh. Unison is much better suited for two-way synchronization than rsync.
- foxcub 11y agoI love unison, but how do you use it with inotify?
- skrause 11y agoNewer versions of Unison (since around 2012) can watch directories with inotify: http://blog.nguyenvq.com/blog/2011/07/18/real-time-file-synchronization-like-dropbox-via-unison/ http://blog.nguyenvq.com/blog/2011/07/18/real-time-file-sync...
- 11y ago
- electrum 11y agoThere is a standard tool, ssh-copy-id, that does the job of sshpair.
- merlincorey 11y ago* Standard on Debian based OSes
- stephenr 11y agoIt's literally just a shell script, it's not like it can't be ported to other *nixes http://anonscm.debian.org/cgit/pkg-ssh/openssh.git/tree/contrib/ssh-copy-id http://anonscm.debian.org/cgit/pkg-ssh/openssh.git/tree/cont...
- groks 11y ago$ rpm -qf /usr/bin/ssh-copy-id openssh-clients-6.9p1-6.fc22.1.x86_64
- stephenr 11y agoYes, its actually in the contrib directory in the openssh source (I didn't realise this until I just checked) https://anongit.mindrot.org/openssh.git/tree/contrib/ssh-copy-id https://anongit.mindrot.org/openssh.git/tree/contrib/ssh-cop...
- merlincorey 11y agoHmmm, yes, it seems it is more generally distributed now than it was in the past. I just found it's on a lot more distributions than I had recalled. This is good to learn!
- raimue 11y agoThis sshpair is actually quite dangerous as it simply overwrites your existing key.
- np422 11y agoWhy not use the existing rsync over ssh and ssh-copy-id? I think newline is valid in filenames in most *nix filesystems, so the possibility to use an alternative RS would be nice.
- pepve 11y agoThere's also sshfs: https://en.wikipedia.org/wiki/SSHFS https://en.wikipedia.org/wiki/SSHFS
- beagle3 11y agoNote however that sshfs makes a file system available through ssh (with Some caching but not e.g. persistent cache across ssh reconnects), and no off-line persistence - whereas other solutions discussed (sshync, unison, lsync, syncthing) all replicate files (think dropbox) which comes with benefits (quicker access, offline availability) and problems (edit conflicts, stale versions)
- megalodon 11y agoHey. I appreciate the positive response, but this is just something I put together quickly and needs a little refurbishing before it can be considered a viable alternative to something like lsyncd. Top priorities right now are to get rid of ssh-client dependency and to address security concerns. I'd also like to implement file diffing. Your feedback is invaluable!
- vitd 11y agoThis is a small thing - but how do you pronounce the name? Looking at it, I want to call it "ssh sync", but it looks more like it should sound like "shync" (which sounds sort of like Garth from "Wayne's World" saying "schwing!") Just curious because it's hard to discuss a tool verbally if I don't know how to pronounce it.
- megalodon 11y agoI'd go with "ssh sync".
- nickysielicki 11y agoSee also: http://syncmaildir.sourceforge.net/ http://syncmaildir.sourceforge.net/ This is how I do my email, exim running on a DO instance and I send and receive to my laptop via ssh.
- deckard1 11y agoThese are some pretty awful scripts, to be honest. Use Unison (https://www.cis.upenn.edu/~bcpierce/unison/ https://www.cis.upenn.edu/~bcpierce/unison/). Syncing is much more dangerous and difficult than people assume.