A self-hosted, multi-user WebSSH client written in Go. It allows you to manage and connect to your SSH servers through a modern web browser, with a persistent database backend.
- Web-based SSH Terminal: Provides a full-featured xterm.js terminal in your browser.
- Multi-User Support: Users can register and manage their own private SSH connections.
- Admin Panel: Administrators can manage users, approve new registrations, and promote users to admins.
- Persistent Storage: User and connection data are stored in a persistent SQLite database.
- Secure Credential Storage: SSH passwords and private keys are encrypted at rest.
- Secure Connections: Supports secure connections via HTTPS and WSS.
- Optional Authentication: The web interface authentication can be disabled via a command-line flag.
- File Transfer: Upload files from your computer directly to the SSH server via SFTP, and download files or entire directories (as a zip).
- Docker Support: Easy to deploy using
docker-compose. - Multi-Platform Support: Docker images are available for
linux/amd64andlinux/arm64. Binaries are provided forlinux,windows, anddarwinon bothamd64andarm64architectures.
This is the easiest way to get started.
-
Get the Project: Clone this repository.
git clone https://github.com/chenu/webssh-go.git cd webssh-go -
Configure
docker-compose.yml:- Open
docker-compose.yml. - Crucially, set the
WEBSSH_ENCRYPTION_KEY. Generate a secure key withopenssl rand -hex 32and replaceyour_64_character_hex_key_herewith it. - Optionally, set the
WEBSSH_ADMIN_PASSWORD. The admin username is fixed toadmin.
- Open
-
Run with Docker Compose:
docker-compose up --build
-
Access:
- Open your browser and navigate to
http://localhost:8080. - Log in with the admin credentials (the username is
admin, and the password is what you set inWEBSSH_ADMIN_PASSWORD). - New users can register and will await admin approval.
- Open your browser and navigate to
To pass command-line flags like --no-auth or --tls, uncomment and modify the command section in docker-compose.yml.
- Example: Enable TLS/HTTPS
- Create a
certsdirectory and place yourcert.pemandkey.pemfiles inside. - Uncomment the
portsmapping for8443:8443indocker-compose.yml. - Uncomment the
volumesmapping for./certs:/app/certs. - Uncomment and update the
commandsection:
Restart the service withcommand: > ./webssh --tls --cert-file /app/certs/cert.pem --key-file /app/certs/key.pem
docker-compose up --build. Your service will be available athttps://localhost:8443. - Create a
If you prefer to run without Docker.
-
Prerequisites:
- Install Go (version 1.24 or later).
-
Clone the Repository:
git clone https://github.com/chenu/webssh-go.git cd webssh-go -
Build:
go build
-
Run:
-
With Multi-User Authentication (Default):
# Generate a key with: openssl rand -hex 32 export WEBSSH_ENCRYPTION_KEY="your_64_character_hex_key_here" # Set the admin password (username is 'admin'). Defaults to 'admin123'. export WEBSSH_ADMIN_PASSWORD="your_secure_password" ./webssh
-
With Single-User Password Mode:
export WEBSSH_PASSWORD="your_secure_password" ./webssh --single-user -
With No Authentication:
./webssh --no-auth
-
With TLS/HTTPS:
./webssh --tls --cert-file /path/to/cert.pem --key-file /path/to/key.pem
-
-
Access:
- For HTTP, visit
http://localhost:8080. - For HTTPS, visit
https://localhost:8443.
- For HTTP, visit
WebSSH-Go can be configured via environment variables and command-line flags.
WEBSSH_ADMIN_PASSWORD: (Multi-User Mode) The password for theadminaccount. If set, it will be used to create or reset the admin password on startup. Defaults toadmin123.WEBSSH_PASSWORD: (Single-User Password Mode) The password for thedefaultaccount. Effective when using the--single-userflag. Defaults todefault123.WEBSSH_ENCRYPTION_KEY: (Required) A 32-byte (64-character hex string) key used to encrypt and decrypt sensitive connection details (passwords and private keys) in the database. The application will not start without it. This key cannot be changed later, or all encrypted connection info will become unreadable.- You can generate a secure key using OpenSSL:
openssl rand -hex 32
- You can generate a secure key using OpenSSL:
You can view all available flags with ./webssh --help.
-
--no-auth: (boolean, defaultfalse) Enables "no-authentication mode". Disables all login and authentication, providing direct access to the application. Ideal for environments with existing external authentication (e.g., a reverse proxy). This flag takes precedence over--single-user. -
--single-user: (boolean, defaultfalse) Enables "single-user password mode". The system has only one fixed user,default, whose password is set via theWEBSSH_PASSWORDenvironment variable. Registration and admin features are disabled. -
--tls: (boolean, defaultfalse) Enables TLS to serve over HTTPS/WSS. -
--cert-file: (string) Path to the TLS certificate file (e.g.,cert.pem). Required when--tlsis enabled. -
--key-file: (string) Path to the TLS private key file (e.g.,key.pem). Required when--tlsis enabled. -
--disable-download: (boolean, defaultfalse) Disables only the file and directory download functionality. Uploading and listing files will still be possible. -
--disable-file-browser: (boolean, defaultfalse) Disables the entire file browser functionality (upload, download, and listing). This option takes precedence over--disable-download.
To quickly test the HTTPS functionality, you can generate a self-signed certificate using openssl:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost"This will create key.pem and cert.pem files in the current directory.
- Login: If authentication is enabled, log in with your configured credentials.
- Admins: Use the admin credentials (e.g.,
admin/your_secure_password). - New Users: Click "Register", create an account, and wait for an administrator to approve it from the Admin Panel.
- Admins: Use the admin credentials (e.g.,
- Admin Panel: Admins will see an "Admin Panel" button. From there, you can approve pending registrations and manage existing users.
- Add a Connection:
- On the main page, fill in the details for your SSH server (Name, Host, User, Password or Private Key).
- Click "Save Connection".
- Connect:
- Click the "Connect" button next to the saved connection you wish to use.
- A new terminal tab will open and establish the SSH session.
- Upload a File:
- In an active terminal tab, click the folder icon in the top-right to open the File Browser.
- Navigate to the target directory where you want to upload the file.
- Click the "Upload File" button in the file browser and select your file.
- Download a File or Directory:
- In the File Browser, find the file or directory you want to download.
- Click the "Download" button next to the entry. Directories will be automatically zipped before being downloaded.
This project is licensed under the MIT License.