Skip to main content

Remote Bash Shell with reverse SSHFS local directory mounting

Project description

Remote Bash Shell (remote_bash)

PyPI version Python Version License: MIT

🚀 Make Your Remote Server Feel Local

Tired of complex file sync setups? Confused by rsync, scp, or NFS exports?
Frustrated when local computing isn't enough — but sharing data with a remote server feels like a nightmare?

remote_bash solves this with one simple command.

With rbash or remote_bash, you can:

  • 🔄 Mount your local folder directly into a remote server using a reverse sshfs tunnel
  • 🖥️ Run remote code on your data, just like it's local — ideal for training, compiling, debugging, or experimentation
  • 🔐 Skip the hassle of SSH key sharing — everything is temporary and secure
  • 🧼 Automatic cleanup after session ends (including keys and mount points)

All without:

  • ❌ NFS configuration
  • ❌ Manual SSH forwarding
  • ❌ Sharing full system access

Whether you're a developer, data scientist, or systems engineer —
rbash makes remote environments feel just like home.

Features

  • Automatic local directory mounting to remote workspace via reverse SSHFS
  • Reverse SSH tunnel + sshfs (no NFS configuration or port forwarding required)
  • Temporary key exchange with automatic cleanup (no permanent SSH key setup needed)
  • Seamless integration with your existing ~/.ssh/config
  • Auto-cleanup of mounts, keys, and temporary files after session ends
  • Host discovery from SSH config with tabular output

Installation

pip install remote-bash

Quick Start

List available remote hosts from your SSH config:

rbash
# or
remote_bash

Connect to a specific host:

rbash <hostname>
# or
remote_bash <hostname>

The <hostname> must be a valid Host entry in your ~/.ssh/config.

Example Usage

rbash myserver

This command will:

  1. Create a temporary SSH keypair on the remote machine
  2. Add the remote public key to your local authorized_keys
  3. Establish a reverse SSH tunnel to your local machine
  4. Mount your current directory to /home/remote_user/workspaceXXXXXX on the remote server
  5. Drop you into an interactive bash shell on the remote machine

Requirements

Local Machine

  • Python 3.8+
  • ssh client
  • sshfs (FUSE filesystem)

Remote Machine

  • SSH server
  • sshfs (FUSE filesystem)
  • FUSE support enabled

Installation of Dependencies

Ubuntu/Debian:

sudo apt install sshfs

macOS:

brew install sshfs

CentOS/RHEL/Fedora:

sudo yum install sshfs  # CentOS/RHEL
sudo dnf install sshfs  # Fedora

SSH Configuration

Ensure your ~/.ssh/config contains the target hosts. Example:

Host myserver
    HostName 192.168.1.100
    User myuser
    IdentityFile ~/.ssh/id_rsa

Host production
    HostName prod.example.com
    User deploy
    Port 2222
    IdentityFile ~/.ssh/prod_key

How It Works

  1. Host Discovery: Parses your ~/.ssh/config to find available hosts
  2. Temporary Key Generation: Creates a temporary SSH keypair on the remote machine
  3. Reverse Tunnel Setup: Establishes a reverse SSH connection from remote to local
  4. Directory Mounting: Uses SSHFS to mount your local directory on the remote machine
  5. Interactive Shell: Drops you into a bash shell with your local files accessible
  6. Automatic Cleanup: Removes temporary keys, unmounts directories, and cleans up on exit

Security

  • Uses temporary SSH keys that are automatically removed after the session
  • No permanent modifications to SSH configurations
  • All connections use your existing SSH config and key authentication
  • Reverse tunnel is automatically torn down on exit

Troubleshooting

Permission Denied

Ensure your SSH key has proper permissions and the remote user has sudo access for FUSE mounting.

SSHFS Not Found

Install sshfs on both local and remote machines using your system's package manager.

Connection Refused

Verify the host configuration in your ~/.ssh/config and ensure you can connect manually with ssh <hostname>.

Contributing

Contributions are welcome! Please ensure:

  • Scripts remain portable across Unix-like systems
  • SSH compatibility is maintained
  • Include tests for new features
  • Follow existing code style

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

[1.2.0] - 2025-08-01

Bug Fix

  • Update remote system check with sshf and fuse

[1.1.0] - 2025-07-31

Bug Fix

  • Update path of bash.sh

[1.0.1] - 2025-07-31

Added

  • Update the pip install remote-bash

[1.0.0] - 2025-07-31

Added

  • Initial release of remote_bash
  • CLI commands: rbash and remote_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/config in table formatere’s a complete README.md for your PyPI package Remote Bash Shell (rbash), along with a CHANGELOG.md to track versions.

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

remote_bash-1.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

remote_bash-1.2.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file remote_bash-1.2.0.tar.gz.

File metadata

  • Download URL: remote_bash-1.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for remote_bash-1.2.0.tar.gz
Algorithm Hash digest
SHA256 11dfafd1dc8c5adf4152f227ddadfe3e9b820614d1dd5a3c787f5723cd178453
MD5 e1f5654cefe63fe6990b8ed9fa950750
BLAKE2b-256 79c13a9912cdf247a2e0894972b8f04cc1c4c44ae89741ea9d41134a05f581c8

See more details on using hashes here.

File details

Details for the file remote_bash-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: remote_bash-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for remote_bash-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d04baa91733f17985be082436416f9e5c16995d3689a258023f2a50533241ab
MD5 d52b2eb7c9cc680c0fc28c695958c083
BLAKE2b-256 3eaf029510a7d3b384d8f06378af47313fceef177e2dbcc7e0587265e00e9f62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page