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.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.1.0.tar.gz (5.9 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.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: remote_bash-1.1.0.tar.gz
  • Upload date:
  • Size: 5.9 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.1.0.tar.gz
Algorithm Hash digest
SHA256 0b286b1ae456d52a50af434c01fccbf10aff9637a6526912345112f8fbec091f
MD5 2c6fb0b0209c2d01d17930379954d80b
BLAKE2b-256 e052eb48c2dfe2fc4fb4beb4fa09eeedb913690ea188145014e89f185cab773c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: remote_bash-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7c829ae180cc9b3584842419507367a67f6268f871b2d8efc6e605171b3d660
MD5 3429391e151a7fdddf779aed458c4e87
BLAKE2b-256 a6394ad606f63309f28e3efc56b97d681ea038542b93ffffe701d8bb07818fa7

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