npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sshfs-automount

v1.0.0

Published

Automated idempotent multi-server SSHFS mounting tool with legacy OpenSSH & modern Linux compatibility

Readme

🚀 Auto SSHFS Multi-Server

English | Bahasa Indonesia

Automation script for mounting and unmounting remote directories across multiple servers (supporting both modern Linux distributions like Ubuntu 20.04/22.04/24.04 and legacy OS like CentOS 6.5) using SSHFS and SSHPASS or SSH Private Keys.


📋 Table of Contents


✨ Key Features

  • 🔄 Idempotent Mounts: Automatically detects whether a directory is already mounted and skips it safely to avoid duplicate mounts or filesystem locks.
  • 🔌 Broad SSH Compatibility: Out-of-the-box support for legacy OpenSSH (CentOS 6.5 / OpenSSH 5.3 with diffie-hellman-group1-sha1 / ssh-rsa) and modern OpenSSH without manual SSH config edits.
  • 🔑 Dual Authentication: Supports both password-based authentication (sshpass) and SSH private key authentication.
  • Auto-Reconnect & Keep-Alive: Configured with ServerAliveInterval and reconnect flags to prevent FUSE session drops across network fluctuations.
  • 🚀 Pre-flight Fast Reachability Check: Tests target host and port via sub-second native TCP probes before mounting to avoid long timeouts on unreachable hosts.
  • 🧹 Graceful & Lazy Unmounting: Inspects /proc to report active locking processes and provides --lazy detachment.
  • 📊 Column-Aligned Status Dashboard: Clear, formatted table output for easy monitoring.

📦 System Requirements

Install the required packages on your local workstation:

# Ubuntu / Debian
sudo apt update && sudo apt install -y sshfs sshpass fuse3

# RHEL / CentOS / Rocky Linux
sudo yum install -y sshfs sshpass fuse
# or (CentOS 8+ / RHEL 8+)
sudo dnf install -y epel-release && sudo dnf install -y sshfs sshpass fuse3

📂 Directory Structure

/mnt/automount/
├── mount.sh              # Core execution script (mount/unmount/status)
├── servers.conf.example  # Configuration template (safe for version control)
├── servers.conf          # Active credentials (ignored by Git)
├── test_mount.sh         # Module architecture self-test
├── CONTEXT.md            # Domain glossary & ubiquitous language
├── README.md             # English documentation
└── README.id.md          # Indonesian documentation

⚙️ Configuration (servers.conf)

Copy the example template to create your live configuration:

cp servers.conf.example servers.conf
chmod 600 servers.conf

[!CAUTION] Security Notice: Never commit servers.conf to public Git repositories. It is included in .gitignore by default. Always restrict permissions (chmod 600 servers.conf).

Line Format:

NAME|HOST|PORT|USER|PASSWORD|REMOTE_PATH|LOCAL_MOUNT_POINT|KEY_PATH

Field Definitions:

| Index | Field | Description | Default if omitted | |---|---|---|---| | 1 | NAME | Unique server identifier (no spaces) | (Required) | | 2 | HOST | Target IP address or hostname | (Required) | | 3 | PORT | Remote SSH port | 22 | | 4 | USER | SSH username | root | | 5 | PASSWORD | SSH password (or - if using SSH key) | (Required unless key specified) | | 6 | REMOTE_PATH | Remote directory path to mount | / | | 7 | LOCAL_MOUNT_POINT | Local destination mount path | /mnt/automount/<NAME> | | 8 | KEY_PATH | Path to SSH private key (optional) | ~/.ssh/id_rsa (if password omitted) |

Configuration Examples:

# 1. Modern Ubuntu server with Password Auth
ubuntu-prod|192.168.1.50|22|ubuntu|PassUbuntu123|/var/www/html|/mnt/automount/ubuntu-prod|

# 2. Legacy CentOS 6.5 server with Password Auth
centos-legacy|192.168.1.60|22|root|PassCentos456|/home/data|/mnt/automount/centos-legacy|

# 3. Server using SSH Private Key Auth
prod-worker|10.10.1.20|22|deployer|-|/app|/mnt/automount/worker|~/.ssh/id_ed25519

# 4. Custom port with default local mount point
sftp-node|sftp.example.com|2222|sftpuser|SecretPass|/uploads||

🖥️ Usage Guide

1. Mount Remote Shares

# Mount all servers listed in servers.conf
./mount.sh mount all
# or simply:
./mount.sh

# Mount a specific server by name
./mount.sh mount ubuntu-prod

2. Check Mount Status

# Display dashboard for all servers
./mount.sh status

# Check status of a single server
./mount.sh status ubuntu-prod

3. Safely Unmount

# Unmount all active servers
./mount.sh unmount all

# Unmount a single server
./mount.sh unmount ubuntu-prod

# Force unmount if directory is busy or held by active processes
./mount.sh unmount ubuntu-prod --lazy

🛡️ Special Compatibility (CentOS 6.5 vs Modern Ubuntu)

Connecting between modern Linux clients (Ubuntu 22.04+) and legacy servers (CentOS 6.5 / OpenSSH 5.3) often fails due to deprecated crypto algorithms:

  • no matching key exchange method found (diffie-hellman-group1-sha1)
  • no matching host key type found (ssh-rsa)
  • no matching cipher found (aes128-cbc, 3des-cbc)

mount.sh automatically includes backward-compatible algorithms in the SSH wrapper command:

-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
-o KexAlgorithms=+diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 \
-o Ciphers=+aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

🔧 Troubleshooting

1. "fuse: device not found, try 'modprobe fuse'"

Run on host:

sudo modprobe fuse

2. "Device or resource busy" during unmount

Another terminal or background process is inside the directory. Find locking processes or use --lazy:

./mount.sh unmount <server_name> --lazy

3. Network unreachable timeout

mount.sh executes a 2-second fast reachability probe. If the remote port is blocked by firewall or down, it will immediately flag the server as unreachable without stalling other mount targets.