SSHFS

SSHFS is a FUSE Filesystem based on the SSH and SFTP Protocol.

Mounting

sshfs [user@]host:[dir] mountpoint [options]

Automount

fstab entry:

user@host:/remote/path /local/path  fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/id_rsa,allow_other,reconnect 0 0

Options

OptionDescription
-p PORTSSH Port, equivalent to -o port=PORT
-fdo not daemonize, stay in foreground.
-sSingle threaded operation.
-CEnable Compression, equivalent to -o compression=yes
-F ssh_configfilespecifies alternative ssh configuration file
-o reconnectautomatically reconnect to server if connection is interrupted. Attempts to access files that were opened before the reconnection will give errors and need to be re-opened.
-o delay_connectDon’t immediately connect to server, wait until mountpoint is first accessed.
-o sshfs_syncsynchronous writes. This will slow things down, but may be useful in some situations.
-o no_readaheadOnly read exactly the data that was requested, instead of speculatively reading more to anticipate the next read request.
-o sync_readdirsynchronous readdir. This will slow things down, but may be useful in some situations.
-o idmap=TYPEHow to map remote UID/GIDs to local values. none: no translation of the ID space (default). user: map the UID/GID of the remote user to UID/GID of the mounting user. file: translate UIDs/GIDs based upon the contents of --uidfile and --gidfile.
-o uidfile=FILEfile containing username:uid mappings for -o idmap=file
-o gidfile=FILEfile containing groupname:gid mappings for -o idmap=file
-o ssh_command=CMDexecute CMD instead of ‘ssh’
-o transform_symlinkstransform absolute symlinks on remote side to relative symlinks. This means that if e.g. on the server side /foo/bar/com is a symlink to /foo/blub, SSHFS will transform the link target to ../blub on the client side.
-o follow_symlinksfollow symlinks on the server, i.e. present them as regular files on the client. If a symlink is dangling (i.e, the target does not exist) the behavior depends on the remote server - the entry may appear as a symlink on the client, or it may appear as a regular file that cannot be accessed.
-o no_check_rootdon’t check for existence of ‘dir’ on server
-o dir_cache=BOOLEnables (yes) or disables (no) the SSHFS directory cache. The directory cache holds the names of directory entries. Enabling it allows readdir system calls to be processed without network access.
-o dcache_max_size=Nsets the maximum size of the directory cache.
-o dcache_timeout=Nsets timeout for directory cache in seconds.
-o dcache_{stat,link,dir}_timeout=Nsets separate timeout for {attributes, symlinks, names} in the directory cache.
-o dcache_clean_interval=Nsets the interval for automatic cleaning of the directory cache.
-o dcache_min_clean_interval=Nsets the interval for forced cleaning of the directory cache when full.
-o direct_ioThis option disables the use of page cache (file content cache) in the kernel for this filesystem.
-o max_conns=Nsets the maximum number of simultaneous SSH connections to use. Each connection is established with a separate SSH process. The primary purpose of this feature is to improve the responsiveness of the file system during large file transfers.