As a system administrator, you probably connect to remote servers using a program such as GNOME Terminal (or the like) if you’re on a Linux desktop, or a SSH client such as Putty if you have a Windows machine, while you perform other tasks like browsing the web or checking your email.

Wetty – Linux Terminal Access in Browser

Wouldn’t it be fantastic if there was a way to access a remote Linux server directly from the web browser? Luckily for us all, there is a tool called Wetty (Web + tty) that allows us to do just that – without the need to switch programs and all from the same web browser window.

Installing Wetty in CentOS 7 and Debian 8

Wetty is available from the GitHub repository of its developer. For that reason, regardless of the distribution you’re using some dependencies must be installed first manually before cloning the repository locally and installing the program.

In Fedora-based distros (in CentOS 7 and RHEL 7, the EPEL repository must be enabled first):

# yum update && yum install epel-release git nodejs npm

In Debian and its derivatives, the version of NodeJS available from the distribution’s repositories as of September 2015 (0.10.29) is older than the minimum version required to install Wetty (0.10.31), so you have to install it from the NodeJS GitHub developer repository:

Change the working directory to wetty, as indicated in the message above:

# cd wetty

then install Wetty by running:

# npm install

If you get any error messages during the installation process, please address them before proceeding further. In my case, the need for a newer version of NodeJS in Debian was an issue that had to be solved before running npm install successfully.

Starting Wetty and Access Linux Terminal from Web Browser

At this point, you could start the web interface in local port 8080 for Wetty by running (this assumes your current working directory is /wetty):

# node app.js -p 8080

As you can see in the image below:

Access Wetty Linux Terminal from Web

But do yourself a favor and DO NOT enter your username and password since this connection is not secure and you don’t want your credentials to travel through the wire unprotected.

For that reason, you should always run Wetty through HTTPS. Let’s create a self-signed certificate to secure our connection to the remote server:

The last command in the above sequence will start Wetty in the background listening on port 8080. Since we are using a self-signed certificate, it is to be expected that the browser will show a security warning – It is perfectly safe to ignore it and add a security exception – either permanently or for the current session:

Wetty – SSL Security Warning

After you have confirmed the security exception you will be able to login to your VPS using Wetty. It goes without saying that you can run all commands and programs as if you were sitting in front of a real or virtual terminal, as you can see in the following screen cast:

Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

@Alan,
If you followed the installation instructions at the top of this post, you must have installed npm. You can verify this by running
dpkg -l | grep npm
or
which npm
If npm is installed (as it should), the first command should return the actual package name, whereas the output of the second command will show the path to the executable file. Otherwise, install npm first following the instructions given here.
Next, install the bytes module:
sudo npm install bytes
Then try again and let us know how it went.

There was another NPM module that it complained about missing too. Did some Googling and found the NPM website, and looked at the services it needed. Did NPM installs on those items, then it worked.

Between the help here, and doing some brainstorming, I’m figuring out how to make things work.

Now, if I could just figure out how to have Wetty start on a reboot, I’d be good. Right now, I have to login to the machine, start the service, and then I can access it with a web browser. The terminal I opened to add the command has to stay open, though, which kind of defeats the purpose.

I don’t really need a secure connection for it; the port isn’t available to the outside, so I just want to have it start on regular HTTP, not HTTPS.

Wanted to be able to access it from inside my home network with my cellphone, but for some reason, it doesn’t pop up the keyboard on my phone after I connect(I see the login prompt, but my phone’s browser doesn’t recognize that it needs keyboard input). I haven’t tried my Android tablet, but I suspect it will have the same result.. Not sure how to resolve that, but I’ll try to figure it out.

Of course, if I could find a terminal application for my Android phone that actually allows me to SSH into Linux boxes on my home network, that might even eliminate the need for Wetty for anything other than the Windows box.

Thank you again to everyone that has helped. I am an amateur at this, and it’s a learning curve, but I’m enjoying learning Linux.

@Alan,
I am replying to this comment because I didn’t find the Reply link on the one below. If you’re still looking for an application that allows you to SSH into your Linux servers using your Android phone, I’d highly recommend JuiceSSH (https://juicessh.com/). I’ve used it in a production environment and gets the job done pretty well. Hope it helps.

@Ivaylo,
As Wetty works over a web connection, I would say it’s best to go with the certificates (you may want to consider using one signed from a CA if you don’t want your users to run into the “This connection is not trusted” message). Otherwise, feel free to check the GitHub repository for further ideas on how to use Wetty. You may even suggest this option be included in future releases of the program.