Remote Bash Shell with reverse SSHFS local directory mounting
Project description
Remote Bash Shell (remote-bash)
🚀 Make Your Remote Server Feel Local — Instantly
Tired of juggling rsync, scp, or NFS just to work with a remote server?
Need the power of a remote GPU server, but still want the comfort of editing locally?
remote-bash lets you mount your local directory directly into a remote server, run commands there, and clean up when you’re done — all with one command.
No messy setup, no permanent SSH key sharing, no manual reverse tunnels.
✨ How It Works (Version 2.0.0)
When you run:
rbash myserver
Here’s what happens under the hood:
- Validate Host – confirms that
myserverexists in your~/.ssh/config(but can proceed even if missing). - Prepare Remote Workspace – creates a unique workspace folder (e.g.,
/home/user/workspace12345678) on the remote machine. - Temporary SSH Key Exchange
- Generates a remote-only keypair.
- Adds the remote public key to your local
authorized_keys(with a special tag for later removal).
- Reverse SSH Tunnel – opens a reverse tunnel from the remote back to your local machine.
- SSHFS Mount – mounts your local working directory into the remote workspace using the reverse tunnel.
- Interactive Remote Bash – drops you into a bash shell on the remote with your local files mounted and ready.
- Automatic Cleanup (on exit) – unmounts the workspace, deletes temporary keys (both sides), and removes the workspace folder.
🔹 Why Use This Instead of NFS / Manual SSHFS?
- No permanent key sharing — security-friendly
- No root or NFS setup — works in user space
- Automatic reverse tunnel — works even if remote server can’t directly reach your machine
- One command — handles mount, shell, and cleanup for you
- Python-powered — portable and easily installed via
pip
📦 Installation
pip install remote-bash
Requires:
- Python 3.8+
sshclient installed locallysshfsinstalled locally and remotely- FUSE enabled on both machines
🔹 Example Usage
List available hosts from your SSH config:
rbash
Connect to a host:
rbash myserver
Mount a specific local path:
rbash myserver --path ~/projects/myapp
Change the base reverse tunnel port:
rbash myserver --port 2225
Strict host key checking (disable host-key suppression):
rbash myserver --strict
🛠 Requirements
Local
- Python 3.8+
sshsshfs
Remote
sshsshfs- FUSE enabled
⚙ SSH Configuration Example
~/.ssh/config:
Host myserver
HostName 192.168.1.100
User ubuntu
IdentityFile ~/.ssh/id_rsa
🔍 Security
- All SSH keys used are temporary and automatically removed.
- Your
authorized_keysentry is tagged, so it’s deleted after the session. - No changes are made to system-level SSH configuration.
- Reverse tunnel exists only for the duration of your session.
🧼 Cleanup Behavior
When you exit the remote bash session:
- Workspace is unmounted
- Temporary SSH keys are deleted
- Reverse tunnel is closed
- Authorized key entry is removed
If you pass --no-clean, keys and mounts remain for debugging.
🐛 Troubleshooting
Permission Denied
Ensure your SSH connection to the host works manually:
ssh myserver
sshfs not found
Install on both local and remote:
sudo apt install sshfs # Ubuntu/Debian
brew install sshfs # macOS
remote port forwarding failed
The requested port is in use on remote; rbash will automatically select an available one starting from --port.
fuse: unknown option(s): -o nonempty
Remove -o nonempty. Newer FUSE versions don’t support it. remote-bash doesn’t use it.
📄 License
MIT License — see LICENSE.
📜 Changelog
[2.0.0] - 2025-08-10
Changed
- Completely rewrote core logic in Python (
remote.pyclass +cli.pyentrypoint) replacing older shell script. - Manages session lifecycle programmatically (prepare, run, clean).
- Temporary SSH key injection/removal to local
authorized_keys. - Local port availability check before starting reverse tunnel.
- Clear subprocess logging and error handling.
[1.2.0] - 2025-08-01
Fixed
- Remote system check for
sshfsand FUSE before attempting mount.
[1.1.0] - 2025-07-31
Fixed
- Corrected path resolution for
bash.sh.
[1.0.1] - 2025-07-31
Added
- README updated with
pip install remote-bash.
[1.0.0] - 2025-07-31
Added
- Initial release of
remote_bash. - CLI commands:
rbashandremote_bash. - Reverse SSHFS mounting with local → remote path mapping.
- Remote temporary SSH key exchange.
- Automatic cleanup of keys, mounts, and workspace.
- Host listing from
~/.ssh/configin table format.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file remote_bash-2.0.0.tar.gz.
File metadata
- Download URL: remote_bash-2.0.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
798ca4054677a4e78778ee9f64f9ef0e82f8dc4c450afc9a6ef19276de82b8eb
|
|
| MD5 |
5c67d5b0204bf4df26135a64906a474a
|
|
| BLAKE2b-256 |
88d30010a01b17fa7bc44422e7e27bfcbbcc6b92a4b0859ccea2e20e0f8c214d
|
File details
Details for the file remote_bash-2.0.0-py3-none-any.whl.
File metadata
- Download URL: remote_bash-2.0.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a859428fbfb63de7d3a2330f5ecf5fd250494570adff728b72abef58a029e4e9
|
|
| MD5 |
0f28292443d8b9fa1a2bd059c22f172a
|
|
| BLAKE2b-256 |
14e3465329b0215636920953bb71bcc1ddb7ebfdd231ef6a682c8618ce7084eb
|