---
arch-wiki: https://wiki.archlinux.org/title/SSHFS
obj: filesystem
rev: 2024-08-26
---

# SSHFS
SSHFS is a FUSE Filesystem based on the [SSH](../../applications/network/SSH.md) and SFTP Protocol.

## Mounting
```shell
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
| Option                                | Description                                                                                                                                                                                                                                                                                         |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-p PORT`                             | SSH Port, equivalent to `-o port=PORT`                                                                                                                                                                                                                                                              |
| `-f`                                  | do not daemonize, stay in foreground.                                                                                                                                                                                                                                                               |
| `-s`                                  | Single threaded operation.                                                                                                                                                                                                                                                                          |
| `-C`                                  | Enable Compression, equivalent to `-o compression=yes`                                                                                                                                                                                                                                              |
| `-F ssh_configfile`                   | specifies alternative ssh configuration file                                                                                                                                                                                                                                                        |
| `-o reconnect`                        | automatically 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_connect`                    | Don't immediately connect to server, wait until mountpoint is first accessed.                                                                                                                                                                                                                       |
| `-o sshfs_sync`                       | synchronous writes. This will slow things down, but may be useful in some situations.                                                                                                                                                                                                               |
| `-o no_readahead`                     | Only read exactly the data that was requested, instead of speculatively reading more to anticipate the next read request.                                                                                                                                                                           |
| `-o sync_readdir`                     | synchronous readdir. This will slow things down, but may be useful in some situations.                                                                                                                                                                                                              |
| `-o idmap=TYPE`                       | How 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=FILE`                     | file containing username:uid mappings for `-o idmap=file`                                                                                                                                                                                                                                           |
| `-o gidfile=FILE`                     | file containing groupname:gid mappings for `-o idmap=file`                                                                                                                                                                                                                                          |
| `-o ssh_command=CMD`                  | execute CMD instead of 'ssh'                                                                                                                                                                                                                                                                        |
| `-o transform_symlinks`               | transform 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_symlinks`                  | follow 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_root`                    | don't check for existence of 'dir' on server                                                                                                                                                                                                                                                        |
| `-o dir_cache=BOOL`                   | Enables (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=N`                | sets the maximum size of the directory cache.                                                                                                                                                                                                                                                       |
| `-o dcache_timeout=N`                 | sets timeout for directory cache in seconds.                                                                                                                                                                                                                                                        |
| `-o dcache_{stat,link,dir}_timeout=N` | sets separate timeout for {attributes, symlinks, names} in the directory cache.                                                                                                                                                                                                                     |
| `-o dcache_clean_interval=N`          | sets the interval for automatic cleaning of the directory cache.                                                                                                                                                                                                                                    |
| `-o dcache_min_clean_interval=N`      | sets the interval for forced cleaning of the directory cache when full.                                                                                                                                                                                                                             |
| `-o direct_io`                        | This option disables the use of page cache (file content cache) in the kernel for this filesystem.                                                                                                                                                                                                  |
| `-o max_conns=N`                      | sets 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.                                                    |