I've found a bug and there's no solution in this FAQ, what should I do?
Please send the bug report to <email@example.com>.
Also logs with debugging output can be useful for diagnosing the problem. Try running sshfs with the following options:
sshfs -odebug,sshfs_debug,loglevel=debug ...
Doing strace on the application which fails may also sometimes help:
strace -f -o /tmp/strace application args ...
Note that large messages (over 40k) will be rejected from the mailing list. So try to keep the logs as short as possible.
What options does sshfs support?
I figure that these actually come from fuse, but these options I am aware of
- -o idmap=user - translates the user ID of the connecting user (see below)
- -o uid=<uid> - use <uid> as the user identifiers on the client.
- -o gid=<gid> - use <gid> as the group identifiers on the client.
- -o nonempty - allow nonempty mount point.
The user ID translation makes sure the files you see are owned by you. Say, your local user ID is 1234 and the user ID on the remote host is 5678. When you connect with -o idmap=user, everything that's owned by 5678 appears to be owned by 1234, same applies other way round.
Another list of options is available from Google Code Wiki for MacFUSE project: http://code.google.com/p/macfuse/wiki/OPTIONS
When I perform a move or copy operation, does sshfs first move the file to the host, then back to the server, or does it move the file from the target dir to the destination dir on the server without touching the host?
The move is done on the server side, no transmission of data is needed.
Why do permissions in nautilus not work?
Try the options -o idmap=user -o uid=<your local uid> -o gid=<your local gid> as described above, if the remote filesystem has different uid / gid number than your local one.
In Nautilus, all folders are reported as having 1TB (1000.0 GB) free. Nice but not at the same time...
This is normal. The underlying SFTP-protocol doesn't support reporting free space properly.
Advantage of sshfs over NFS and Samba
Users can mount remote resources they already have ssh access to, without requiring the remote machine to export the resource.
The remote resource can be mounted when it is needed in a location that is convenient for the user at that time, without needing to rely on a central, root-controlled file system table.
Automatic mounting, if desired, can be added to a shell script such as .bashrc (provided authentication is done using RSA/DSA keys).
Resources can be mounted over slow and unreliable (distant) connections.
Create the device node
If you don't use udev, you may get this error message:
fusermount: failed to open /dev/fuse: No such device or address
Before loading the fuse kernel module, create the device node manually:
mknod -m 666 /dev/fuse c 10 229
mv fails with "Operation not permitted".
version > 1.3).
cvs fails with "cvs [status aborted]: cannot get working directory: No such file or directory" in a sshfs mounted directory
-oreaddir_ino option. Example: sshfs -oreaddir_ino hostname:remote_dir mount_point
Changes on the server are not immediately visible in the mounted directory.
sshfs caches things for 20 seconds, use
-o cache_timeout=N to change the default cache timeout (in seconds)
-o cache=no for disabling the cache.
You can also control cache timeouts for directory listing etc with
-o cache_dir_timout=N, and
Configuring the ssh connection
In addition to flags like
, you may find it easier to edit your ~/.ssh/config=
file. You can add an entry with any customization you want, test it with
ssh, and finally use it with
As a bonus, you get a short mnemonic for your configuration.
What are the
sshfs_sync options for?
These disable read and write optimizations respectively. They don't really make sense unless you're doing something special.
df return strange values on partitions mounted via sshfs?
Because the SFTP protocol doesn't have a
OpenSSH 5.1 added support for a
statfs extension to the SFTP protocol, and from version 2.1
sshfs can make use of this extension. So
df will work if your SFTP server is
5.1 and your sshfs
version is > 2.1.
How do I specfy the remote mount point (since the example defaults to the home directory)
The example shows:
sshfs hostname: mountpoint
To specify a remote mount point use:
sshfs hostname:remotemountpoint mountpoint
This might be obvious to others, but I ended up looking up the interface to sftp to see if I could learn how to specify the remote mount point, then thought about the way that scp specifies the remote directory, and it worked.
sshfs hangs after a while
Mounting works fine, I can use the files in Mountpoint as good as any other files on my system, but after bit of time, changing nothing on the remote files sshfs crashes. This means, I can not cd into the Mountpoint (xterm hangs, nautilus hangs... every program trying to access the Mountpoint gets stuck, and won't return).
in your .ssh/config (or use
-o ServerAliveInterval=15 on the sshfs command line but I did not test that solution).
This will force the ssh connection to stay alive even if you have no activity.
Following symlinks on the server side
-o follow_symlinks option will enable this.
Making absolute symlinks work
-o transform_symlinks option, which will transform absolute symlinks (ones which point somewhere inside the mount) into relative ones.
Mounting as root
Generally it's not possible to use an sshfs mount as a "real" filesystem shared between multiple users. Some of this functionality can be enabled with the
-o allow_other and
-o default_permissions options, but files will not be created with the correct ownership, etc...
Exporting via NFS
Use the userspace NFS daemon http://sourceforge.net/projects/unfs
Automatical mounting using /etc/fstab
A line in /etc/fstab has the following format:
sshfs#USERNAME@REMOTE_HOST:REMOTE_PATH MOUNT_POINT fuse SSHFS_OPTIONS 0 0
firstname.lastname@example.org:data /mnt/guest fuse uid=1003,gid=100,umask=0,allow_other 0 0
Why does SVN (etc...) fail with permission denied?
This is a bug that happens when an application creates a read-only file opened for writing (e.g. open("foo", O_WRONLY||O_CREAT, 0444))
It has been fixed in sshfs version 1.3, but also requires FUSE version >
2.5.X and Linux kernel version >2.6.15.
Why does SVN (etc...) fail to rename files?
$ svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
svn: Can't move 'kdelibs/.svn/tmp/entries' to 'kdelibs/.svn/entries': Operation not permitted
The reason is that SFTP protocol version 3 (which is implemented by OpenSSH's sftp-server) defines the rename operation slightly differently than POSIX. The difference is that renaming to an existing file or directory will fail instead of atomically replacing the old file.
-o workaround=rename option will try to emulate POSIX rename semantics, but it cannot guarantee atomicity.
In most of the cases this doesn't matter, and things will work fine with this option.
Is there some neat way to do it in reverse?
You want to mount a USB thumb drive onto a file server that is rather remote.
Assuming this is difficult because the laptop with the thumb drive is sitting behind NAT, firewalls, etc. then you need to create a port-forward:
client$ ssh -R 2222:localhost:22 server server$ sshfs -p 2222 localhost:/media/usb1 myusb1
(Now, is there is there a smarter way that does not involve port opening login permissions in an undesireable direction?)
Might it be reasonable to disallow loops?
sshfs localhost:/mnt /mnt
This seems to produce undesirable results. --JoshuaRodman
What would be the desirable result? An example: Windows denies CIFS-access to localhost and as a result you can not ssh-forward windows shares. --PetriSirkkala
How to mount through an intermediary ssh server, eg: localhost -> A -> B; mount B from localhost
Start by mounting the folder you need that is on "a" to a folder on "b" then mount the new folder that is on "a" to a folder on localhost.
IE: (These are NOT real commands, but a sequence of steps.
A mounts B:/home/x on /mnt/Bx
localhost mounts A:/mnt/Bx on ~/mydir
1) Create a shell script to wrap the tunneling of one ssh command over another,
$ cat >Atunnel <<EOF #!/bin/bash ssh -q A ssh -q "$@" EOF $ chmod u+x Atunnel
N.B. make sure to put this somewhere on your path.
2) sshfs mount as normal but using this script as the ssh command.
$ sshfs -o ssh_command='Atunnel' B: ~/mydir
Works beautifully for me. -- JadRef
Another Alternate Solution:
This solution is the easiest for me to grasp. Use ssh tunnels to tunnel an ssh connection. As a bonus, it makes multiple hops really easy.
First create the tunnel on port 9999
ssh machineA -L 9999:machineB:22
Now tunnel sshfs to the right spot
sshfs -p 9999 username@localhost
! I seem to have successfully mounted a remote directory, but performing an `ls -l` on the directory above the mount point shows the mount point's attributes as `?----- ? ? ? ? ?`. Nothing shows up in the directory either. What am I doing wrong?
You probably specified a remote path with the tilde (~) in it. This doesn't seem to work. Instead, specify an absolute remote path:
$ sshfs email@example.com:/home/username/whatever my/mount
Yet Another Solution (the simpler one) using ProxyCommand
ProxyCommand directive will automate the creation of a channel to communicate with the server behind the SSH gateway.
With a recent OpenSSH version (>=5.4), you can use
ssh -W in your
~/.ssh/config file this way:
host host.behind.gateway ProxyCommand /usr/bin/ssh -W %h:%p your.gateway.host
If -W is not available, then you can use the
netcat utility this way:
host host.behind.gateway ProxyCommand /usr/bin/ssh your.gateway.host nc %h %p
With your new OpenSSH configuration you cam simply run this command to mount the filesystem in the host behind de SSH gateway:
sshfs host.behind.gateway:/tmp /mnt/tmp/
What options do i use to make playing media files (music) over sshfs more efficient?
MacFUSE doesn't seem to let me move files from one directory to another. It first asks for my local user password (i.e. the password on my Macbook Pro) and then produces the error message "The operation cannot be completed because one or more required items cannot be found. (Error code -120).
How can I get procmail to open, read and write to remote directories over sshfs?
How do I mount a filesystem read-only?
sshfs -o ro hostname: mountpoint