Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed steps for installing Wetty on a Linux system

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "detailed steps to install Wetty in the Linux system", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the detailed steps of installing Wetty in the Linux system"!

What is Wetty?

Wetty = Web + tty

As a system administrator, if you are under the Linux desktop, you can use it to connect to a remote server like a GNOME terminal (or similar); if you are under Windows, you can use it to connect remotely like using a SSH client like Putty, and then you can surf the Internet and check email and other things in the browser at the same time.

Installation steps

Step 1: install the epel source

The code is as follows:

# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

# rpm-ivh epel-release-6-8.noarch.rpm

Step 2: install dependencies

The code is as follows:

# yum install epel-release git nodejs npm-y

Step 3: after installing the dependencies, clone the GitHub repository

The code is as follows:

# git clone https://github.com/krishnasrinivas/wetty

Step 4: run Wetty

The code is as follows:

# cd wetty

# npm install

Step 5: launch Wetty from a Web browser and access the Linux terminal

The code is as follows:

# node app.js-p 8080

Step 6: install the HTTPS certificate for Wetty

The code is as follows:

# openssl req-x509-newkey rsa:2048-keyout key.pem-out cert.pem-days 365-nodes

Waiting to be finished.

Step 7: use Wetty through HTTPS

The code is as follows:

# nohup node app.js-sslkey key.pem-sslcert cert.pem-p 8080 &

Step 8: add a user to wetty

The code is as follows:

# useradd

# Passwd

Step 9: visit wetty

Http://Your_IP-Address:8080

Enter the certificate you previously created for wetty and visit it.

Setting up wetty does not require account login to perform command line operations

We see that when we enter http://127.0.0.1:3000 in the browser for access, we also need to enter the account password for authentication (as shown in the first line of the figure below).

However, in some application scenarios, we do not need the user to enter the account password for authentication, and the user does not necessarily know the account password. We want the user to open the command operation directly.

Entering node app.js in the command line terminal prompts you to start the wetty service with a description of all the options.

From these options in the figure above, we can see that wetty performs terminal operations through ssh, and-sshauth is used to specify the authentication mode of ssh, which defaults to password, which means authentication is performed through account password.

There are four authentication methods for Ssh: hostbased, publickey, keyboard-interactive and password. Among them, password is the account password authentication method we mentioned above; publickey is the RSA public key authentication method; and the other two are not concerned about for the time being.

Wetty uses password authentication by default, and we can specify publickey authentication by-- sshauth option. The authentication mechanism for ssh public key is:

The user stores his public key on the remote host. When logging in, the remote host sends a random string to the user, which is encrypted with his own private key and then sent back. The remote host uses the pre-stored public key for decryption, if successful, it proves that the user is trusted, directly allows login to the shell, and no longer requires a password.

Then we need to open a command line terminal and type

The code is as follows:

$ssh-keygen

To generate our public and private keys.

The public key and key generated by this command are stored in the ~ / .ssh directory by default.

The private key is saved in the id_rsa file, and the public key is saved in the id_rsa.pub file.

The above ssh public key authentication mechanism provides that we need to save the public key to the remote machine and save it in the ~ / .ssh/authorized_keys file in the user's home directory after login. The public key is a string, just append it to the end of the authorized_keys file. At this point, our remote machine is the local machine, so we just need to make a copy of ~ / .ssh/id_rsa.pub and name it authorized_keys.

The code is as follows:

$cp ~ / .ssh/id_rsa.pub ~ / .ssh/authorized_keys

Then we change to the wetty directory and start the wetty service

The code is as follows:

$node app.js-p 3000-- sshauth=publickey

Then type http://127.0.0.1:3000/ in the browser, and you can see that you can operate directly without entering the account password, as shown in the following figure.

If we find it too troublesome to specify the-sshauth option every time we start, we can directly modify the source code in the app.js file. When we open the app.js file, we can see that the default authentication mode of the sshauth specified in line 45 is password, we just need to change it to publickey.

Thank you for your reading, the above is the content of "the detailed steps of installing Wetty in the Linux system". After the study of this article, I believe you have a deeper understanding of the detailed steps of installing Wetty in the Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 221

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report