Skip to content

How to execute Linux command using client/server architecture [closed]

What I want here is a client logging in my website and can execute any Linux command.

What is the best practice to achieve it. Should I use HTML/JavaScript and PHP backend running on Apache. Or I googled something and found node.js. You can think as i want to simulate a Linux terminal for client in a web browser.

Do you think I need a Linux machine running in the back end? And if yes, how will it handle multiple users logging in and executing commands. Will it create instance of each session and executes for it. Just curious how this will work.

For example: “4 users logged in into my website and hence 4 different sessions are created for them. They all sees a Linux terminal. They all send some Linux command and press enter.” I want to simulate this.

Answer

I would strong recommend you to use JavaScript at both ends as you’re dealing with servers now so you need hyper fast execution of the app.

I suggest you following things for your project :

  1. Node.JS — for Backend
  2. AngularJs — for frontend
  3. SSH2 npm module
  4. MongoDB
  5. Mongoose ODM

node.js will help in your project as it fast and asynchronous in nature. it’s fast and compatible.

Angular.js will help you at frontend as it doesn’t render or executes whole HTML it do only a part or view of it, so it becomes hyper fast in nature.

For if you want to use database too. Then my recommendation would be using MONGODB with mongoose as its ODM.

SSH2 wrapper is an advance tool for the purpose you’re looking at.

Note: LAMP has been killed almost by MEAN stack. So using PHP would increase your writing of code as well as task of maintaining it too.