Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Nautilus set up to mount a remote filesystem using SFTP.

That works fine, so far, but SFTP seems to have some issues I find unhelpful:

  1. When I overwrite an existing text file, the group read permissions are mysteriously removed on the remote machine.
  2. When I try to attach a file to an email by dragging it to thunderbird, I get an sftp:// url which TB can't use (yet, if I open the TB attach dialogue and browse though .gvfs, all is well).

None of this happens when I manually mount the same filesystem through SSHFS. Is it possible to configure Nautilus to use SSHFS? A plugin maybe? It doesn't appear on the "Connect to Server" list of available options.

EDIT: It's been pointed out that sshfs uses the sftp protocol as a backend. While that maybe true, the real problem is that accessing files via Nautilus is less smooth than mounting via sshfs, and I'd like to figure out how to get Nautilus to do it the nice way.

share|improve this question

From Wikibook OpenSSH

Another way to transfer files back and forth, or even use them remotely, is to use sshfs It is a file system client based on SFTP and utilizes the sftp-subsystem. It can make a directory on the remote server accessible as a directory on the local file system which can be accessed by any program just as if it were a local directory. The user must have read-write privileges for mount point to use sshfs.

So finally it is both the same way of communication. SSHFS uses SFTP. The difference is that sshfs is a file system driver which allows to mount a drive which allows access via SFTP. Nautilus however does not mount drives, it only shows them. You can add your Filesystem to /etc/fstab to have it mounted at boot time, however I do not suggest that as the ssh connection might not be available. Easier would be to setup a bash script which can be ran as startup application.

The behaviour described in #2 is only logical: as you have connected via SFTP only, the file you drag into thunderbird does not exist in your file system, but as a remote path.

Edit because of the comment:

Maybe I explained it not good enough. Here an example: If your remote ressource is on server fooserver and the root directory is foodir, the file is in foosubdir/foofile, then the ressource path is sftp://fooserver/foodir/foosubdir/foofile. WHen you use Nautilus SFTP, this is still the only path for you to access this file, it is remote. If you use sshfs instead, the contents of foodir become available from within your file system - sshfs is a file system driver. Then it is as if the file were stored on your harddisk. The contents of the ressource sftp://fooserver/foodir are logically mapped into your mount directory ~/.gvfs . Then thunderbird can access this file from within your local file system context as ~/.gvfs/foosubdir/foofile . Thunderbird does not even notice that it is a remote file, the sshfs file system driver integrated into the klinux kernel does abstract that for you.

share|improve this answer
No, #2 is not logical. The file system is mounted under .gvfs and I can access the file fine through that. – ams Dec 14 '11 at 11:53
edited my posting to explain it more. But maybe I only did not understand your Issue in #2 correctly. – Michael K Dec 14 '11 at 12:03
Exactly, so what I want is for nautilus to provide the local path, not the remote path that local programs can't use. It doesn't do that when you double click on a file, so why does it do it when I drag the file? – ams Dec 14 '11 at 12:08
I just tried it.Created a text file on a SFTP ressource and opened it with doubleclick.Gedit opened and showed it with its sftp:// path. Also a right-click and Properties shows that it is a remote ressource. So I understand now what you really intend to do but I see no easy solution. GVFS seems to only provide the remote url, which in your context is a valid ressource, but of course not if you send it as an email. – Michael K Dec 14 '11 at 12:18
It's really mounted under /run/user/[your uid]/gvfs/[something]/. Nautilus just shows sftp:// because Ubuntu. Same for Trash - Trash is really ~/.local/share/Trash/files. – Hitechcomputergeek Jun 5 at 0:26

To mount Host's remote folder so that you can treat remote files as if they were local on your Client, use sshfs instead of sftp.* You will need an OpenSSH Server on Host before the following will work.

Mount Host's remote folder on local Client

From Client, run [1]:

test -e ~/mountpoint || mkdir --mode 700 ~/mountpoint
sshfs ~/mountpoint -p <port-number>

Start using Nautilus

Now open the local folder ~/mountpoint in Nautilus. Congratulations, you can treat remote files as if they were local on your Client!

Unmount Host's remote folder on local Client

fusermount -u ~/mountpoint

*Details: SFTP is for file transfer to and from Client and Host while SSHFS is a file system client that makes remote files behave as local. It's as if you temporarily synchronized Host's remote folder with a virtual local folder.

As you interact with these SSHFS files, your local Client will SSH a copy from Host to Client so things behave as if they were local on your Client. Any changes you make, however, take effect upon the remote Host and remain even after you unmount.

share|improve this answer
Vandalising the question doesn't make this answer any more relevant. If I wanted to know how to use SSHFS from the command line I'd have asked for that. Besides, the question clearly indicates that I knew how to do that. – ams Nov 14 '14 at 22:51
@ams: Apologies for my honest mistake. Please clarify your question and question title. How is "Nautilus set up to mount a remote filesystem using SFTP"? Why is a startup script with my first two commands not equivalent? Are you looking for an end or a means (via plugin, via "Connect to Server") as best answer? Again, my apologies for misunderstanding. – jtd Nov 14 '14 at 23:06
3 years ago, I think I was looking to get the GUI to Just Work. I'm quite capable of building a stack of magic scripts, but I don't see why I should have to. Even today it doesn't work. – ams Nov 14 '14 at 23:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.