Terminal implementation in Node-Red-Dashboard

If this is all too much, you might look at butlerx/wetty: Terminal in browser over http/https. (Ajaxterm/Anyterm alternative, but much better) (github.com)

Just because you have the node-red hammer, not every task is a nail :rofl:

1 Like


Yes youre right, this task is more like a process to me :sweat_smile:

I'm normaly good with computers and I'm studying computer science right now but in the module Webapplications I ained my worst grade so far to be honest, so please dont get me wrong :joy:

We are all learning :rofl:

The actual answer to this revolves around what you exactly want to do. There are lots of alternatives.

If it is just for you or a few people, you could use one of the remote access solutions such as Cloudflare Zero Trust or NGROK, etc. Many of these will implement a web-based terminal and would take care of the security for you (NGROK not secure by default but easily made so).

If you only need to be able to run a couple of commands and get the feedback from/to a web page then you could just use Dashboard buttons and input fields and use the data to run the commands via exec nodes (though noting that you may really want to secure that carefully!).

Okay, perfect :smile:

I gonna explain you what i want to do.

So.. Currently I'm woking on a project, to do messurements with up to 125 sensors which are connected to a controller. The controller is communicating over Modbus TCP and can easily be changed by changing the ip-adress in the dashboard (You can also change the Network-configuration of the raspberry in the dashboard). The user is able to enter a interval for the messurement. All the incoming data is gonna be saved in a database which can be manipulated etc. . I gonna set up the Raspberry as an accesspoint so you can connect any device, which you can open the dashboard with. I want now to have a terminal with full functionality, so the user of the dashboard has full access to the raspberry (without any ssh-connection).

How do you intend to manage the authentication and authorisation? Also, how many users and is this a commercial project (changes the nature of the services you may need).

Personally, I would not consider using node-red to provide privileged/user access to the OS unless you really didn't care about someone trashing the device (e.g. have some process that will auto-reset the OS back to a known good configuration).

Rather, I would use either a separate service that delivers a web-based secured console or use a cloud access service that can deliver SSH over a browser (e.g. Cloudflare Zero Trust and others).

If running your own service, I would also strongly recommend putting everything behind a reverse proxy to provide robust authentication and security. But for small numbers of users on a limited SBC, I'd probably go for an external service.

I thought about a password to access the terminal. Mostly there will be just one person, working with the raspberry. And it will just be powered on when somebody has to do some messurements. Because of that security isnt such a big deal for me in this project.. It will never be connected to a network which has access to the internet (just in a network with controllers). Or what are your thoughts about this? I know security in generall is a very big deal (especially because I want to work in cyber security later) but because of the given scenario I dont really break my head about it :smile:

OK, that does change things.

I'd go for one of the tools built on xterm.js that provides a web terminal directly. There is a list on the xterm.js website.

Something like Wetty.

Trying to install Wetty right now but always getting an error :face_with_peeking_eye:

Did you do:

sudo apt update
sudo apt install -y build-essential curl python

I assume you followed the guide here:

WeTTY = Web + TTY (butlerx.github.io)

Though I advise NOT using nvm. As long as you have at least node.js v14 installed, you should be fine.

Still trying to install :melting_face:

Yarn is always throwing a known error:

And npm always finds some vulnerabilities:

Sometimes.. I really, really hate my life :joy:

Hmm, I don't use Yarn.

I tried it and got the same error.

Starting manually I got:

It seems that wetty wants to use port 3000 which is already in use for me because it is used by Grafana.

Whats npm start doing? When I'm trying that it says: Missing script: "start"

You can start it manually with:

cd ~/.config/yarn/global/node_modules/wetty
npm start -- --port 3001 --base / --title wetty

The install was a bit strange in that it tries to install "globally" but only for the current user if you follow their install instructions. Not seen that before. I would probably just install locally to a suitable folder. Much simpler but you use the wetty command which seems to be the bit that is failing on the install anyway.

There is a service file in the packages config folder that can be used with systemd to get it to start automatically on boot.

Seems like the installation is incomplete?

Ah, you installed it as system global I see. not such as good idea. Uninstall and install to the user you want to use it with instead (ideally a separate user).

WeTTY = Web + TTY (butlerx.github.io)

The command install still fails but my manual start should work.

1 Like

Seems like its working? :face_holding_back_tears:

Yes its working i can see the terminal :partying_face:

Thank you so, so much for all your effort! :+1:

Gonna do a break for today and complete it tomorrow. I will share the result in this topic :smile:

1 Like

Yes, it seems to work OK, got it working while listening in on a boring meeting. :slight_smile:


Hello again :smile:

So I continued with the project but I dont get it how I'm able to connect xterm with wetty. I suggest theres something wrong with the socket. Have never done this before and I dont exactly understand how to set this up.


When connecting to localhost:3001 everything is working fine but with this configuration nothing is showing up in the dashboard.