Installation guide for LinuxMint under Tty.js

Source: Internet
Author: User

1.Introduction

Tty.js is an Open source web-based SSH developed using node. js. remote access via browser Shell.

Introduction to web-based SSH reference Https://en.wikipedia.org/wiki/Web-based_SSH.

For the tty.js project , please refer to the following two pages

Https://www.npmjs.com/package/tty.js

https://github.com/chjj/tty.js/

2.installation

Tty.js is a node. js writer , We need to install node. js before installing, refer to http:/ /www.cnblogs.com/lienhua34/p/4830891.html.

Run the following command to download The source code for tty.js from GitHub ,

$ git clone https://github.com/chjj/tty.js.git

Then go to the tty.js directory and install it using npm ,

sudo Install

node-gyp rebuild errors may occur during the run of npm install ,

At this point we need to run the following two commands for processing ,

sudo Install build-sudoinstall -G Node-gyp

Then run sudo npm install again.

3.Validation3.1RunTty.js

In the bin directory, there is a tty.js executable file that runs the file,

$ cd bin &&./tty.js

You can start the Tty.js service, which listens on the 8080 Port,

Open the browser and enter http://127.0.0.1:8080/ to access tty.js, then click Open Terminal in theupper right corner of the page You can open a Web terminal for command-line operation (as shown).

3.2CustomTty.jsService

We can create a new mytty.js file in the root directory , and then enter the following content,

var tty = require ('./lib/tty.js '); var app = tty.createserver ({  ' bash ',  users: {    ' bar '  },  8000}); App.get (function(req, res, next) {  res.send (' bar ');}); App.listen ();

In tty.createserver () , you customize the TTY service, where the shell sets up the terminal program that starts, andtheusers sets the authentication user information whenaccessing the Web page, andport sets the service listening port number. Save the file, and then run the following command,

$ node Mytty.js

Then enter http://127.0.0.1:8000/in the browser, enter theuser name and password input box, enter foo and bar, You can then open The page for the TTY service.

3.3 TTYconfiguration file for the service

The configuration file for the Tty.js service is ~/.tty.js/config.json, which saves the associated configuration in JSON format. A configuration sample, as shown below,

{"  users": {    "hello": "World"  },  "https": {    "key": "./server.key",    "cert": "./server.crt"  },  "port": 8080,  "hostname": "127.0.0.1",  "shell": "Bash",  "static": "./static",  " Limitglobal ": 10000,  " Limitperuser ": +,  " localonly ": false,  " CWD ":". ",  " syncsession ": false ,  "Sessiontimeout": 600000,  "log": True,  "io": {"log": false},  "Debug": false,  "term": {    "Termname": "Xterm",    "geometry": [[+],    "scrollback": +,    "Visualbell": false,    "Poponbell" : false,    "Cursorblink": false,    "Screenkeys": false,    "colors": [      "#2e3436",      "#cc0000",      "#4e9a06",      "#c4a000",      "#3465a4",      "#75507b",      "#06989a",      "#d3d7cf",      "#555753 ",      " #ef2929 ",      " #8ae234 ",      " #fce94f ",      " #729fcf ",      " #ad7fa8 ",      " #34e2e2 ",      " # EEEEEC "    ]  }}
3.4inHTTPSProtocol Start Service

We run the OpenSSL command in the ~/.tty.js directory to generate an SSL certificate for ourselves.

$ OpenSSL req-x509-newkey RSA:204830000 -nodes

Then two files Cert.pem and Key.pemare generated in the ~/tty.js directory. Then modify the configuration file sample above to ~/tty.js/config.json , and then modify the HTTPS configuration as shown in

Then run bin/tty.js,

Then enter https://127.0.0.1:8080/in the browser, the browser will prompt that this is a risky site, continue to access.

(done)

Installation guide for tty.js under LinuxMint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.