Interactive SSH tunnel and file transfer manager built with Bash.
Release: v1.0.0
License: AGPLv3
TunnelOps is an interactive Bash utility for managing SSH port forwarding and remote file transfers. It supports:
- Dynamic local port forwarding (multiple
-Lmappings) - File and directory transfer via
scpwith optional recursive copy - Optional privileged placement on the remote host (using remote
sudo) - Configuration persistence and unattended auto-start (
--auto) via a savedconfig.env
- Password or key-based SSH authentication (
sshpasssupported for password auth) - Interactive prompts for username, server IP, auth method, and operation
- Port forwarding with multiple mappings
- File transfer with optional recursive copy and remote sudo placement
- Auto-start support using
crontab/cronie(interactive install prompt available) - Logs and configuration stored in user directories following XDG conventions
- Bash (recommended v4+)
- OpenSSH client tools:
ssh,scp - Optional:
sshpass(for password-based authentication) - Optional:
cronie(for cron-based auto-start)
Clone the repository and make the script executable:
git clone https://github.com/rdarshan927/tunnelops.git
cd tunnelops
chmod +x tunnel.shInstall from the Arch User Repository (example using yay):
yay -S tunnelopsOptional dependencies (install as needed):
sshpass— required only for password-based SSH authenticationcronie— optional, required for cron auto-start support
Run interactively (installed or local):
# If installed from AUR
tunnelops
# If running from repository
./tunnel.shExample unattended mode (auto):
./tunnel.sh --autoNotes:
- When installed from AUR the command
tunnelopsruns the packaged script. --autoloadsconfig.envfrom the user's configuration directory and starts the saved tunnels without interactive prompts.
The script will prompt for the following information when run interactively:
- SSH username
- Remote server IP address (IPv4)
- Authentication method:
- Password (requires
sshpass), or - SSH private key file path
- Password (requires
- Operation type:
- Port Forwarding — enter the number of mappings, then for each mapping enter a local port and remote port
- File Transfer — provide local path, remote destination, choose recursive if copying directories, and indicate if remote sudo is required
- Builds and runs an
ssh -N -fcommand with one or more-Lrules - Runs the tunnel in the background and logs output to the user log file
- Uses
scpfor file and directory transfers - For password auth the script uses
sshpassif available - If remote sudo is required, the script uploads to a temporary path (e.g.,
/tmp/...) and attempts asudo mvon the remote host viassh
- Configuration (saved by the script) is stored at:
~/.config/tunnelops/config.env
- Logs are stored at:
~/.local/share/tunnelops/logs/tunnel.log
These paths respect the XDG environment variables XDG_CONFIG_HOME and XDG_DATA_HOME when set.
- The script can add an
@rebootcron job to start saved tunnels at user login/reboot. - If
crontab/cronis not found, the script offers to detect the package manager and installcronorcronieinteractively (requiressudo).
- GitHub repository: https://github.com/rdarshan927/tunnelops
- AUR package page: https://aur.archlinux.org/packages/tunnelops
- Password-based authentication stores credentials in
config.envonly if you choose to save configuration; files are written with restrictive permissions. - For unattended use, prefer SSH key authentication and avoid saving plaintext passwords where possible.
- Protect private keys with
chmod 600.
Contributions, issues, and suggestions are welcome. When submitting changes, follow secure coding practices and avoid embedding sensitive credentials in source.
This project is distributed under the GNU Affero General Public License v3.0 (AGPLv3). See the LICENSE file for full terms.