How to create linux terminal like tutorialspoint?

 

[Question]

TutorialsPoint Java Compiler

In tutorialspoint, they have created linux terminal using term.js.

I have integrated same github library in my project, it is working fine but I am trying to understand the flow of tutorialspoint.

My assumption:

  • In tutroialspoint each time they are creating new user_id under root user(cg) and running terminal(nodejs server) using that user_id so every time when you reload page there will be a different user_id (run whoami in terminal), so another user can't operate other users files.

I am running nodejs server using forever.js under root user, I want to implement same type of functionality. What is correct way to do this? and if there is another way please elaborate.

--------------------------------------

[ANSWER] 

I think they are creating a new user each time you visit the page and providing you a subshell of that user. It can be easily achieve by using Shell Programming techniques. Creating a new user each time thing is probably nothing more than a security measure.

So I will briefly explain the concept in 5 steps:

1 - Create a new user:

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

shell_exec('useradd --expiredate 2016-09-10 [username]');

http://www.computerhope.com/unix/useradd.htm

2 - Login to this newly created user account:

shell_exec('su [username]');

3 - Get user input to the PHP script using AJAX(dynamically).

4 - Execute user's command and send the output to user:

<?php
$output = shell_exec("[user's command]");
echo "<pre>$output</pre>";
?>

5 - Repeat from 3.

 

[출처] https://stackoverflow.com/questions/39400712/how-to-create-linux-terminal-like-tutorialspoint

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1100 [ 一日30分 인생승리의 학습법 ] REST API URL 규칙 졸리운_곰 2022.11.26 37
1099 [ 一日30分 인생승리의 학습법 ] prolog 문법 : Prolog Syntax 졸리운_곰 2022.11.21 89
1098 [ 一日30分 인생승리의 학습법 ] noVNC 작동원리 file 졸리운_곰 2022.11.16 39
1097 [ 一日30分 인생승리의 학습법 ] 프로젝트 만들고 GitHub에 첫 Commit하고 Push하기 file 졸리운_곰 2022.11.15 30
1096 [ 一日30分 인생승리의 학습법 ] 우분투(리눅스) 에서 EBS 라디오 자동녹음 만들기 졸리운_곰 2022.11.11 37
1095 [ 一日30分 인생승리의 학습법 ] EBS FM 라디오, rtmp 서비스 중단 졸리운_곰 2022.11.11 32
1094 [ 一日30分 인생승리의 학습법 ] 악보 읽는 방법 file 졸리운_곰 2022.11.08 99
1093 [ 一日30分 인생승리의 학습법 ] 13가지 주요 오픈소스 프로젝트 file 졸리운_곰 2022.10.09 44
1092 [ 一日30分 인생승리의 학습법 ] 극상의 학습 난이도로 입문자 울리는 프로그래밍 언어 Top 10 졸리운_곰 2022.09.03 45
1091 [빅데이터의 활용의 오해] 데이터가 당신을 스마트하게 만들고 있을까? 졸리운_곰 2022.09.01 36
1090  [ 一日30分 인생승리의 학습법 ] [Git] Git 명령어 정리 졸리운_곰 2022.08.16 46
1089 [ 一日30分 인생승리의 학습법 ] LLVM이란 file 졸리운_곰 2022.08.13 48
1088 [ 一日30分 인생승리의 학습법 ] Build Your Own Remote Desktop Application using Javascript, Python & WebRTC — Part 2 file 졸리운_곰 2022.08.05 56
1087 [ 一日30分 인생승리의 학습법 ] Build Your Own Remote Desktop Application using Javascript, Python & WebRTC — Part 1 file 졸리운_곰 2022.08.05 61
1086 [ 一日30分 인생승리의 학습법 ] REST API 규칙 졸리운_곰 2022.08.03 56
1085 [ 一日30分 인생승리의 학습법 ]REST API 설계 (네이밍) 졸리운_곰 2022.08.03 48
1084 [ 一日30分 인생승리의 학습법] [2탄!!] KrakenD Demo 면을 알아보죠! file 졸리운_곰 2022.08.01 66
1083 [ 一日30分 인생승리의 학습법] [1탄!!]KrakenD가 무엇인가? 과연 Api Gateway로 으뜸인가요? file 졸리운_곰 2022.08.01 37
1082 [ 一日30分 인생승리의 학습법] 오픈소스 라이선스 별 의무사항 졸리운_곰 2022.07.29 50
1081 [ 一日30分 인생승리의 학습법] The complete guide to (external) Domain Specific Languages file 졸리운_곰 2022.07.08 54
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED