SSHFS

From MEPIS Documentation Wiki

Jump to: navigation, search

Contents

Introduction

From Wikipedia entry: SSHFS (Secure SHell FileSystem) is a file system capable of operating on files on a remote computer using just a secure shell login on the remote computer. On the local computer where the SSHFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with remote files being securely served over SSH just as if they were local files on his/her computer.

Server setup

There is not much to setting up MEPIS as an sshfs server, because all you need to do is make sure the SSH server (a.k.a. "sshd") is installed and running. To install SSH server:

apt-get install openssh-server

To start your SSH server, issue this command:

/etc/init.d/ssh start

To make sure it starts on boot, you can use the update-rc.d command. See SSH for more details.

Remember that sshd listens on port 22; you need to open this port in your firewall if you are running one.

Client setup

MEPIS 7.0, 8.0, and 8.5

MEPIS 7.0 and later come with the fuse drivers already installed and sshfs ready to use. You need to make sure your user is in the "fuse" group in order to use sshfs. Once you have confirmed this, you can mount a remote system with this command:

sshfs username@hostname:/path/to/location local_mountpoint

Where:

  • "username" is your user name on the server (doesn't have to be the same as the local user name)
  • "hostname" is either the hostname or IP address of the server (use the IP if you can't resolve the hostname)
  • "/path/to/location" is a path to a directory on the server you wish to mount. It must be at least readable by the user you are using. If you don't specify a starting "/", the path will be relative to "username's" home directory.
  • "local_mountpoint" is a directory on your client machine where the server's directory will be mounted.

If you are familiar with rsync, scp, or other ssh-based commands, this syntax is basically identical.

To unmount a directory:

fusermount -u local_mountpoint

Client setup (MEPIS 6.x)

This gets a little more challenging; but followed step by step, it should work without error (You may need to add in a few repositories for this to work, I'm not entirely sure). You will need to be connected to the internet for this to work, BTW.

Method 1: Using sshfs / fuse

  1. Using whatever package manager, install module-assistant, fuse-utils, and sshfs.
  2. Select defaults on the package installs.
  3. Open a root Konsole, and run module-assistant.
  4. Select "UPDATE" from the menu. This just does an apt-get update, so it's not necessary if you've recently done this.
  5. When update has finished, select "PREPARE". This will download all the necessary packages for your machine to compile kernel drivers.
  6. Now go to "SELECT". Scroll down the list of drivers and check the box for "FUSE". Hit "OK".
  7. Now click "BUILD". It will probably ask you if you want to download source for the drivers, and of course say "yes".
  8. When the drivers are done compiling, the program will ask if you want to install them. Naturally, say yes.
  9. Now, exit module-assistant.
  10. When fuse-utils installed, it created a group called "fuse". You need to add users to the "fuse" group if you want them to be able to mount ssh shares. You can do this using Kuser or with this command as root:
adduser userName fuse

NOTE: the group membership will not take effect until you log out and log back in. If you get a permissions error trying to mount a folder, you probably didn't log out first.

  1. Now that that's done, we're ready to mount a folder. The basic syntax for sshfs is this:
sshfs user@server:/path/to/folder /path/to/mountpoint 
  1. To unmount a folder, the syntax is not quite so obvious:
fusermount -u /path/to/mountpoint

Method 2: the fish:/ kio slave

KDE has it's own "kio-slave" to do file browsing over SSH. To use it, you can open Konqueror and type fish://serverName. As with all kio-slaves, many non-kde programs don't work correctly with files being accessed over them. For instance, you cannot directly open an OpenOffice file over a kio-slave connection by clicking on it. You have to copy it locally and then open it.

The syntax for a fish:/ URL is as follows:

fish://user@serverName/path/to/directory

Passwords can be stored in your kwallet for convenience.

Method 3: SHFS

SHFS is a kernel driver for mounting SSH filesystems. This system is somewhat older than fuse and requires root privileges to use, so it's not so ideal from a security standpoint (unless, of course, you only want root mounting remote folders). If you have trouble with other methods, though, it may work for you.

Here's a good how-to: Installing shfs

Personal tools
In other languages