Desktop file sharing for people

Do you remember the good old days when you could set up drive shares between your Windows PC’s and share files between machines? I do, and indeed more recently there’s been all the fun of making SAMBA work between Windows and Linux so Linux PC’s can also share those same files. Although not that difficult, generally it’s a PITA and ultimately you just know that one day either a Windows Update or Linux distro update is going to upset the apple cart and you’ll be configuring it all over again.

Still, good way to keep your skills up, eh?!

Anyway, for today’s generation of “you know where you can stick your Windows box” where all you need is to share files between multiple Linux boxes, there are again a plethora of methods and invariably people will quote NFS without thinking too much. (or of course SAMBA) There are however alternatives, in particular I’m talking about SSHFS, which historically may have come across as a little obscure, but in combination with recent Gnome desktops is THE way to share files at a desktop level.

[float=right][smg id=482 type=preview][/float]So how do we do that then?

Ok, well let’s assume you have SSH running on all your boxes, typically this is what you’re going to have running for the purposes of remote administration. If it’s not running it’s usually very easy to install - on Ubuntu or Mint for example you can do it through the GUI or from the command line;

apt-get install openssh-server

Once you have this running on a box, all you need is a username / password on the box, and everything is set up! (good eh?!)

So, to connect to a local machine on your network, in my example I’m going to use a machine with IP address and because I never hit the wrong key, I’m going to use the root user. :wink:

[float=left][smg id=492 type=preview][/float]Start Here :- First go to Places, and select Connect to Server, this should bring up a form that will ask you for details of where you want to connect to. See the image to the left do see the form filled in with the example details as outlined above.

What you should see then (you may have to wait a couple of seconds depending on your connection and the speed of your machines) is a file browser showing you the files available on the target machine.

What can I do with this?

You can drag and drop files between the target machine and your machine, and you can open files on this remote filesystem directly using any standard Gnome application.

Why is this really cool?

o It’s works over local area networks AND over the Internet
o It’s encrypted, so it’s effectively a secure / VPN link
o Use the book mark option to effectively make the link persistent between reboots
o The only configuration required is listed above!

So if you need high performance file sharing and you have time on your hands, you will need to look at things like NFS, Samba (and dare I say ‘gluster’). However, if you’re looking for a more moderate / desktop experience without all the in depth tek, when these terms are mentioned, cover your ears and run away! These services are great, but technically complex and complete overkill!

An other way is via remote login with X-server forwarding (only recommended within a secure environment behind the firewall). Example here login from a box called “Gauis” onto a box called “Tiberius” and starting the KDE-desktop:

swen@gaius$ ssh -X tiberius
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
Last login: Fri Jun 18 10:48:24 2010
swen@tiberius:~$ startkde

Note: The hostname tiberius must be know either via /etc/hosts (most simple) or via a local DNS. The X-Server must run on both boxes, but KDE shall be not running on gaius, otherwise KDE will not start. So login on gaius as “failsave” without starting the GUI for the user “swen”.

Ok, you might need to detail how file transfers take place in this context … ??

(Your method looks good for “desktop sharing”, but I’m lagging a little re; “desktop file sharing” …)

You just need not file-transfer: The files are on central box and you work with one set of data.

For real file transfer, you can also also use scp from the shell, or setting an ftp-server (for which I see in a home/office environment little use).

Mmm, quite right … but file-sharing was sort of the point of the article … :wink:

… obviously you wouldn’t recommend shell scp for a desktop ‘user’ ( :slight_smile: ) , what would be involved in setting up an FTP server in this context (which is certainly an alternative as the method documented above also works for FTP) …

It would be interesting to see how FTP compares to SSHFS with regards to speed …

I don’t know: My first idea would be that it could be a tick slower, because all data are to be encrypted and decrypted, but with modern machines, that should be not a problem.

Anyway: I will run a small test case for a benchmark and will present here my results.

I was wrong with my first idea: The transfer via ssh need roughly 50% of the time of a ftp transfer. A small report to find here (106 k):

Some remarks:

  1. Yes, I know my C looks Pascal (old love never dies) - it is anyway recycled code
  2. Yes, I know I should not have my main data on ReiserFS, but with a Raid! it is relative safe, but I will switch soon to zfs

C? Pascal? My first question was going to be “what’s wrong with bash?” … :wink:

There is nothing wrong with bash, and when I would had to start from the scratch, I would certainly wrote a shell script, in bash or csh, but I already wrote this little piece of software some years ago and recycling was just too logic and hence handy.