Access Your VPS Command Line from a Browser: A Step-by-Step Guide | You won’t need puTTY

Amin
mabttech
Published in
3 min readMay 21, 2024

Managing a VPS (Virtual Private Server) can be daunting, especially if you frequently need to access the command line interface (CLI) from different machines. What if you could do this directly from your web browser? With tools like Shell In A Box and Wetty, you can access your server’s CLI using Chrome or any other browser, making remote management incredibly convenient. In this guide, we’ll show you how to set up these tools on your Ubuntu 22.04 LTS VPS.

Why Use a Web-Based Terminal?

A web-based terminal allows you to:

  • Access your server’s CLI from any device with a browser.
  • Avoid the hassle of configuring SSH clients on different machines.
  • Manage your server on the go.

I- Setting Up Shell In A Box

Step 1: Update Your Server

Before installing any new software, ensure your server is up-to-date:

sudo apt update
sudo apt upgrade -y

Step 2: Install Shell In A Box

Install Shell In A Box using the package manager:

sudo apt install shellinabox -y

Step 3: Configure Shell In A Box

Open the configuration file:

sudo nano /etc/default/shellinabox

Modify the SHELLINABOX_ARGS line to look like this:

SHELLINABOX_ARGS="--no-beep -s /:SSH:localhost"

Save and exit the editor (Ctrl+O, Enter, Ctrl+X).

Step 4: Restart Shell In A Box Service

Restart the service to apply the changes:

sudo systemctl restart shellinabox

Step 5: Access the Web Terminal

Open your Chrome browser and navigate to:

https://<your_server_ip>:4200

Log in with your SSH credentials to access the terminal.

II- Setting Up Wetty

Step 1: Update Your Server

As always, start by updating your server:

sudo apt update
sudo apt upgrade -y

Step 2: Install Prerequisites

Ensure you have the necessary build tools:

sudo apt install -y build-essential python3 make

Step 3: Install Node.js and npm

Remove Existing Node.js

sudo apt remove nodejs -y
https://nodejs.org/en/download/package-manager
https://nodejs.org/en/download/package-manager

Install NodeSource Node.js Binary Distributions

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

Install Node.js

sudo apt install -y nodejs

Step 4: Install Wetty Globally

sudo npm install -g wetty

Step 5: Start Wetty

Start the Wetty application:

wetty --port 3000

Step 6: Access the Web Terminal

Open your Chrome browser and navigate to:

http://<your_server_ip>:3000/wetty

Log in with your SSH credentials to access the terminal.

III- Security Considerations

Use HTTPS

For secure communication, set up an HTTPS connection using a reverse proxy like Nginx or Apache with an SSL certificate (e.g., from Let’s Encrypt).

Firewall Settings

Ensure your firewall allows access to the necessary ports (4200 for Shell In A Box or 3000 for Wetty).

Authentication

Use strong SSH credentials and consider additional security measures like fail2ban to protect against brute-force attacks.

IV- How to Delete Shell In A Box and Wetty

1. Deleting Shell In A Box

To uninstall Shell In A Box, run:

sudo apt remove shellinabox -y
sudo apt purge shellinabox -y
sudo apt autoremove -y

2. Deleting Wetty

To stop and remove Wetty, follow these steps:

1. Stop the Wetty process:

sudo pkill -f wetty

2. Remove the Wetty package:

sudo npm uninstall -g wetty

By following this guide, you can easily manage your VPS from any device with a browser. Whether you choose Shell In A Box or Wetty, you’ll gain the flexibility and convenience of web-based server management.

V- FAQ and Additional Information

Prerequisites for Wetty

  • Node.js version 18 or higher
  • Make
  • Python
  • Build-essential package

Docker Container

To use Wetty as a Docker container, run:

docker run --rm -p 3000:3000 wettyoss/wetty --ssh-host=<YOUR-IP>

This allows you to open an SSH session to the host given by YOUR-IP under the URL http://localhost:3000/wetty.

HTTPS Support

It is recommended to run WeTTY behind a reverse proxy to enable HTTPS and potentially use Let’s Encrypt for SSL certificates. Popular containers for this are nginx-proxy and traefik. For traefik, there is an example docker-compose file in the containers directory of the Wetty repository.

--

--