Whenever you need to securely copy files from one Linux system to another, you use tools like scp, sftp or rsync. But what if you don't want to copy the files to your local disk before using them? You would normally have to setup a network filesystem, such as NFS, OpenAFS or Samba. Unfortunately, setting either of these network filesystems requires administrator access on both system, something you don't always have access to. So what do you do then? It's simple: you install FUSE and SSHFS. SSH (Secure Shell) is one of the most used programs on a *nix system for at least two reasons. On one hand, an SSH connection is always secured, while on the other hand, it offers a long list of uses, from controlling a Linux system remotely, to what this article is about, mounting remote directories.
- First of all, you'll have to make sure your system has SSH client and server installed and correctly configured (these are parts of most, if not all, Linux distributions).
- To be able to mount remote directories, your system has to have installed a package that offers that support (SSHFS). This package is available for most modern and popular distributions, in their repositories but unfortunately, its name varies.
To install SSHFS on Fedora Core, log-in as root and type:
To install SSHFS on Ubuntu, type:
It's possible that several packages required by sshfs will be installed as well. This is perfectly normal so don't worry.
- To be able to mount remote directories, the local machine has to have the fuse kernel module loaded. It's possible that the service has already been started by the package manager but after a reboot, it might be stopped. First, check if the fuse module is loaded:
If you don't get any message at all, the fuse module isn't loaded so you'll have to execute:
- On Fedora:
- On Ubuntu:
- Moreover, you might want to have the fuse module auto-loaded every time your system boots.
- Finally, the Unix user you're currently using has to be added to group fuse.
on Fedora, type:
on Ubuntu, type:
- At this point, your system is able to mount remote directories. Just type:
- If it doesn't return any errors, you should be able to browse through /path/to/local/folder/ and manage files located there.
To unmount the directory once your work is done, use the command:
NOTE!: Make sure your current working directory isn't the one remotely mounted or the unmount command won't work. First, change directory (cd ...) to another dir and execute that command.