How to Access Linux Server Terminal in Web Browser Using Wetty


If you're a Linux server user, you know how important the command line interface is. The terminal is where you can execute commands to control and manage your server. However, sometimes accessing the terminal can be a hassle, especially if you're on a remote machine or don't have a terminal client installed. That's where Wetty comes in. Wetty is a web-based terminal emulator that allows you to access your Linux server terminal through your web browser. In this article, we'll go over how to set up and use Wetty to access your Linux server terminal.

What is Wetty?

Wetty is a web-based terminal emulator that uses the WebSocket protocol to communicate with a backend terminal session. It allows you to access your terminal through your web browser, making it convenient to use on any device without having to install any software or client. Wetty is built on top of xterm.js, a popular open-source terminal emulator for the web. Wetty can be easily installed on any Linux server and can be configured to run over HTTPS for added security.

Installing Wetty

Before we can start using Wetty, we need to install it on our Linux server. The installation process is relatively simple and requires only a few commands.

Step 1: Install Node.js

Wetty requires Node.js to run. You can install Node.js on your server by running the following command −

sudo apt-get install nodejs

Step 2: Install NPM

NPM is the package manager for Node.js. You can install it by running the following command −

sudo apt-get install npm

Step 3: Install Wetty

You can install Wetty by running the following command −

sudo npm install -g wetty

This will install Wetty globally on your system, allowing you to run it from anywhere.

Configuring Wetty

Once we have installed Wetty, we need to configure it to run on our server. Wetty uses a configuration file to specify its settings. The configuration file is located at /etc/wetty/config.yml.

Step 1: Open the Configuration File

You can open the configuration file in any text editor. For example, you can use nano to open it by running the following command −

sudo nano /etc/wetty/config.yml

Step 2: Configure Wetty Settings

The configuration file contains various settings that you can customize to your liking. Some of the most important settings are −

  • port − The port number that Wetty will listen on. By default, it is set to 3000.

  • sshHost − The hostname or IP address of the server that you want to connect to. This is where Wetty will forward the terminal session. By default, it is set to localhost.

  • sshPort − The port number of the SSH server. By default, it is set to 22.

  • sshUser − The username that you want to use to connect to the SSH server. By default, it is set to the current user.

You can customize these settings to match your server's configuration. For example, if you want to use a different port number, you can change the port setting to your desired value.

Running Wetty

Once we have installed and configured Wetty, we can start using it to access our Linux server terminal. To do so, we need to start the Wetty service.

Step 1: Start the Wetty Service

You can start the Wetty service by running the following command −

sudo systemctl start wetty

This will start the Wetty service and make it available for use.

Step 2: Access Wetty in Your Web Browser

To access Wetty in your web browser, open your browser and navigate to your server's IP address or hostname followed by the port number that you configured in the configuration file. For example, if your server's IP address is 192.168.1.100 and you configured Wetty to listen on port 3000, you would navigate to http://192.168.1.100:3000 in your browser.

You should now see the Wetty login screen. Enter your username and password to log in to your server's terminal.

Using Wetty

Once you have logged in to your server's terminal through Wetty, you can use it just like you would any other terminal interface. You can execute commands, navigate the file system, and run scripts.

Wetty also provides several features that make it easier to use, such as the ability to copy and paste text, resize the terminal window, and use keyboard shortcuts. Wetty also supports multiple concurrent sessions, so you can have multiple terminal sessions open at once.

Security Considerations

While Wetty makes it convenient to access your Linux server terminal through your web browser, it is important to keep security in mind. By default, Wetty uses HTTP to communicate between the browser and the server, which means that the data transmitted between the two is not encrypted. This can potentially allow attackers to intercept and view the data.

To mitigate this risk, you should configure Wetty to use HTTPS instead of HTTP. This will encrypt the data transmitted between the browser and the server, making it more secure.

To configure Wetty to use HTTPS, you will need to generate an SSL certificate and configure Wetty to use it. You can find instructions on how to do this in the Wetty documentation.

Additionally, Wetty can be customized to fit your needs. For example, you can change the default terminal colors and fonts, modify the key bindings, and add plugins to extend its functionality.

Wetty also supports authentication and authorization, which means that you can control who has access to your server's terminal through Wetty. By default, Wetty uses the same authentication mechanism as your SSH server, which means that users must enter their username and password to access the terminal. However, you can also configure Wetty to use other authentication methods, such as OAuth or LDAP.

Moreover, Wetty can be used as a tool for remote collaboration. By giving other users access to your server's terminal through Wetty, you can work together on tasks that require command-line access, such as troubleshooting issues or deploying applications.

Wetty is a powerful and versatile tool that can make managing your Linux server easier and more accessible. Its web-based interface allows you to access your server's terminal from anywhere, using any device with a web browser. With its customization options, security features, and collaborative capabilities, Wetty is a valuable addition to any Linux server administrator's toolkit.

Conclusion

Wetty is a convenient and easy-to-use tool that allows you to access your Linux server terminal through your web browser. It is easy to install and configure and provides several useful features to make using the terminal easier. However, it is important to keep security in mind when using Wetty and to configure it to use HTTPS to encrypt the data transmitted between the browser and the server. With these considerations in mind, Wetty can be a powerful tool for managing your Linux server.

Updated on: 27-Apr-2023

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements