Basic SSHFS

From Crashcourse Wiki

Jump to: navigation, search

Contents

What is SSHFS?

Like NFS, SSHFS supports mounting remote directories on a local host. Unlike NFS, however, SSHFS has the advantage that it doesn't require any special software running on the server, only the SSH server daemon. In addition, SSHFS mounts can be done by regular (non-root) accounts, provided those accounts have been configured to have the proper permissions.

Setting up the server

All that's required on the server side is an SSH server process with support for the SFTP extension. If you're running the SSH daemon on a relatively new Linux distribution, it's almost certain that this is the case. Just make sure SSH is running on the server side:

# service sshd status
# service sshd start       [if necessary]

The client software

On the client side, install the necessary package:

# yum install fuse-sshfs

Configuring your client-side user account

In order to use SSHFS from a regular client-side user account, you need to add that user account to the fuse group as follows:

# usermod -a -G fuse my-user-name

NOTE: Even though you can verify that that user account is now part of the "fuse" group by checking the file /etc/group, you still need to log out and log back in so that your shell is considered to be a part of that group. Until you do that, if you try to perform a SSHFS mount, you'll get the error message:

fusermount: failed to open /dev/fuse: Permission denied

Mounting and unmounting with SSHFS

On the client side, create a bogus directory (if you need one) to use as a mount point:

$ mkdir m

Now, assuming you have another account on the remote host, let's mount, say, its Desktop directory under m:

$ sshfs rpjday@server:Desktop m
rpjday@server's password:XXXXXXXX
$ mount
...
sshfs#rpjday@server:Desktop/ on /home/rpjday/m type fuse (rw,nosuid,nodev,max_read=65536,user=rpjday)
...
$

And unmount it later:

$ fusermount -u m

Additional reading

This recipe just scratches the surface of what you can do with SSHFS. Additional suggested reading:

Feedback to rpjday@crashcourse.ca.

Return to Fedora_Cookbook.

Personal tools