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.0.2] - 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.0.2.tar.gz (4.4 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.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: remote_bash-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 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.0.2.tar.gz
Algorithm Hash digest
SHA256 ba4ab03292b3bccec74f96299b661dd9b9640581d4efad7024a18c58dc77766a
MD5 82162468f7115453e3998d5f6239b887
BLAKE2b-256 14794ec70883d35bc2704abfcefed5420b9c576c0881e8d1b0ec1a4a66143799

See more details on using hashes here.

File details

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

File metadata

  • Download URL: remote_bash-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1a9265f12d68278e3174e94a3df86aa8fbfb6e48a763d884529c7061c9095aa
MD5 dc5b5c15305020143186b092bcb3f3ce
BLAKE2b-256 ca6a78a9494b4a5c7655b1ac68eaa51d2ea75e692eada3ab525cc6ede0c7390f

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