SSHFS(1) | User Commands | SSHFS(1) |
SSHFS - filesystem client based on SSH
To mount a filesystem:
sshfs [user@]host:[dir] mountpoint [options]
If host is a numeric IPv6 address, it needs to be enclosed in square brackets.
To unmount it:
fusermount3 -u mountpoint # Linux umount mountpoint # OS X, FreeBSD
SSHFS allows you to mount a remote filesystem using SSH (more precisely, the SFTP subsystem). Most SSH servers support and enable this SFTP access by default, so SSHFS is very simple to use - there's nothing to do on the server-side.
By default, file permissions are ignored by SSHFS. Any user that can access the filesystem will be able to perform any operation that the remote server permits - based on the credentials that were used to connect to the server. If this is undesired, local permission checking can be enabled with -o default_permissions.
By default, only the mounting user will be able to access the filesystem. Access for other users can be enabled by passing -o allow_other. In this case you most likely also want to use -o default_permissions.
It is recommended to run SSHFS as regular user (not as root). For this to work the mountpoint must be owned by the user. If username is omitted SSHFS will use the local username. If the directory is omitted, SSHFS will mount the (remote) home directory. If you need to enter a password sshfs will ask for it (actually it just runs ssh which ask for the password if needed).
In addition, SSHFS accepts several options common to all FUSE file systems. These are described in the mount.fuse manpage (look for "general", "libfuse specific", and "high-level API" options).
If the SSH server supports the hardlinks extension, SSHFS will allow you to create hardlinks. However, hardlinks will always appear as individual files when seen through an SSHFS mount, i.e. they will appear to have different inodes and an st_nlink value of 1.
Some SSH servers do not support atomically overwriting the destination when renaming a file. In this case you will get an error when you attempt to rename a file and the destination already exists. A workaround is to first remove the destination file, and then do the rename. SSHFS can do this automatically if you call it with -o workaround=rename. However, in this case it is still possible that someone (or something) recreates the destination file after SSHFS has removed it, but before SSHFS had the time to rename the old file. In this case, the rename will still fail.
Most SFTP servers return only a generic "failure" when failing to rename across filesystem boundaries (EXDEV). sshfs normally converts this generic failure to a permission denied error (EPERM). If the option -o workaround=renamexdev is given, generic failures will be considered EXDEV errors which will make programs like mv(1) attempt to actually move the file after the failed rename.
In some cases, attempts to access the SSHFS mountpoint may freeze if no filesystem activity has occured for some time. This is typically caused by the SSH connection being dropped because of inactivity without SSHFS being informed about that. As a workaround, you can try to mount with -o ServerAliveInterval=15. This will force the SSH connection to stay alive even if you have no activity.
By default, network operations in SSHFS run without timeouts, mirroring the default behavior of SSH itself. As a consequence, if the connection to the remote host is interrupted (e.g. because a network cable was removed), operations on files or directories under the mountpoint will block until the connection is either restored or closed altogether (e.g. manually). Applications that try to access such files or directories will generally appear to "freeze" when this happens.
If it is acceptable to discard data being read or written, a quick workaround is to kill the responsible sshfs process, which will make any blocking operations on the mounted filesystem error out and thereby "unfreeze" the relevant applications. Note that force unmounting with fusermount -zu, on the other hand, does not help in this case and will leave read/write operations in the blocking state.
For a more automatic solution, one can use the -o ServerAliveInterval=15 option mentioned above, which will drop the connection after not receiving a response for 3 * 15 = 45 seconds from the remote host. By also supplying -o reconnect, one can ensure that the connection is re-established as soon as possible afterwards. As before, this will naturally lead to loss of data that was in the process of being read or written at the time when the connection was interrupted.
To mount an SSHFS filesystem from /etc/fstab, simply use sshfs` as the file system type. (For backwards compatibility, you may also use ``fuse.sshfs).
The mount.fuse(8) manpage.
If you need help, please ask on the <fuse-sshfs@lists.sourceforge.net> mailing list (subscribe at https://lists.sourceforge.net/lists/listinfo/fuse-sshfs).
Please report any bugs on the GitHub issue tracker at https://github.com/libfuse/libfuse/issues.
SSHFS is currently maintained by Nikolaus Rath <Nikolaus@rath.org>, and was created by Miklos Szeredi <miklos@szeredi.hu>.
This man page was originally written by Bartosz Fenski <fenio@debian.org> for the Debian GNU/Linux distribution (but it may be used by others).