https://github.com/joknarf/fuse-sshautofs
fuse automount sshfs filesystems
https://github.com/joknarf/fuse-sshautofs
autofs automount filesystem fuse sshfs
Last synced: 14 days ago
JSON representation
fuse automount sshfs filesystems
- Host: GitHub
- URL: https://github.com/joknarf/fuse-sshautofs
- Owner: joknarf
- License: mit
- Created: 2025-07-12T08:03:11.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-22T19:37:21.000Z (6 months ago)
- Last Synced: 2025-07-22T21:21:03.092Z (6 months ago)
- Topics: autofs, automount, filesystem, fuse, sshfs
- Language: Go
- Homepage:
- Size: 9.05 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://joknarf.github.io/joknarf-tools)
[]()
[]()
[](https://shields.io/)
# sshautofs
fuse automount sshfs filesystems
Access any remote server filesystems through a `` directory
Remember OGFS ?
* automatic access to servers filesystems through fuse-sshfs when accessing `/`
* transparently use sshfs to mount `sshfs :/ -ssh/`
* creates symlink `/ -> -ssh/` to access
* automatic unmount after timeout
* special cmd directory allow specific remote commands on servers
## Prerequisites
* fuse sshfs
* fuse3
## Usage
```
$ ./sshautofs
Usage: ./sshautofs [options]
Example: ./sshautofs ~/mnt
Options:
-F string
ssh config file to use
-cmd value
Remote commands to expose in /cmd// (e.g. -cmd ps='/bin/ps -ef' -cmd ...)
-foreground
Run in foreground (do not daemonize)
-o string
Additional sshfs options (e.g. -o reconnect,ro)
-remote_path string
Remote path to mount through sshfs (default "/")
-timeout duration
Timeout before unmounting unused sshfs mounts (e.g. 30s) (default 10m0s)
```
## Example
```
$ sshautofs -cmd ps='/bin/ps -ef' ~/servers
$ cd ~/servers/myhost
$ ls -l
lrwxrwxrwx. 1 root root 7 May 1 2023 bin -> usr/bin
drwxr-xr-x. 1 root root 4096 Apr 8 2024 bin.usr-is-merged
drwxr-xr-x. 1 root root 4096 Apr 18 2022 boot
drwxr-xr-x. 1 root root 3860 Jul 11 08:38 dev
drwxr-xr-x. 1 root root 12288 Jul 12 07:43 etc
drwxr-xr-x. 1 root root 4096 May 8 10:53 home
-rwxrwxrwx. 1 root root 2724480 Jun 9 20:32 init
...
$ tail ~/servers/myhost/var/log/messages
Jul 26 14:55:58 myhost systemd...
...
$ cat ~/servers/cmd/myhost/ps
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jul09 ? 00:00:06 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root 2 0 0 Jul09 ? 00:00:00 [kthreadd]
...
$ grep chronyd ~/servers/cmd/myhost/ps
chrony 955 1 0 08:39 ? 00:00:00 /usr/sbin/chronyd
```
> * Automatically mounts `sshfs myhost:/ ~/servers-ssh/myhost` accessible through `~/servers/myhost` symlink
> * the mount is expiring by default after 10min, the sshfs will be unmounted after 10min without access.
> * In the special `cmd` directory, a cat `~/servers/cmd/myhost/ps` executes `ssh myhost 'ps -ef'` and display output