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

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1075 [ 一日30分 인생승리의 학습법] Visual Basic application on linux 졸리운_곰 2022.02.22 16
1074 [ 一日30分 인생승리의 학습법] Truffle을 이용한 DApp 개발환경 구성 file 졸리운_곰 2022.02.20 86
1073 [ 一日30分 인생승리의 학습법]LaTeX 활용해서 논문쓰장 file 졸리운_곰 2022.02.17 20
1072 [ 一日30分 인생승리의 학습법] LaTeX 초보자가 감을 잡는 것을 돕는 몇가지 팁 졸리운_곰 2022.02.17 279
1071 [ 一日30分 인생승리의 학습법] 수식 입력이 가능한 마인드맵 프로그램, 프리플레인(freeplane) file 졸리운_곰 2022.02.16 37
1070 [ 一日30分 인생승리의 학습법] Awesome Metaverse Awesome 짱!~ 메티버스 오픈소스 file 졸리운_곰 2022.02.13 11
1069 [ 一日30分 인생승리의 학습법] 제 NAS의 Docker 목록 file 졸리운_곰 2022.01.31 105
1068 [ 一日30分 인생승리의 학습법] gw basic 튜터리얼, 메뉴얼, A GW-BASIC Tutorial 졸리운_곰 2022.01.22 21
1067 [ 一日30分 인생승리의 학습법] Web Search Engine : 웹 검색 엔진 google/ naver 만들기 file 졸리운_곰 2022.01.17 28
1066 [ 一日30分 인생승리의 학습법] AILog 2 A logic programming language with probabilities and logical explanation and debugging faculities file 졸리운_곰 2022.01.16 12
1065 [ 一日30分 인생승리의 학습법] 소스 인사이트( source insight ) 사용법 file 졸리운_곰 2022.01.13 20
1064 [ 一日30分 인생승리의 학습법][메타버스란 무엇인가?] The Metaverse Has Already Arrived. Here’s What That Actually Means file 졸리운_곰 2021.12.29 24
1063 [ 一日30分 인생승리의 학습법] English to Logic, Truth-Functional Propositional Logic 졸리운_곰 2021.12.15 16
1062 [ 一日30分 인생승리의 학습법][실무행정] 기안문 공문서 기안문 작성법, 행정안전부 지침 및 시행 file 졸리운_곰 2021.12.11 42
1061 [ 一日30分 인생승리의 학습법][실무행정] 기안문 작성하기 졸리운_곰 2021.12.11 17
1060 [ 一日30分 인생승리의 학습법] 셀레니움 헤드리스 테스트를 위한 HTMLUnitDriver 및 PhantomJS file 졸리운_곰 2021.11.26 24
1059 [ 一日30分 인생승리의 학습법] 메타버스로 날개 단 오픈소스 프로젝트 file 졸리운_곰 2021.11.23 230
1058 [ 一日30分 인생승리의 학습법] Best JavaScript machine learning libraries in 2021 file 졸리운_곰 2021.11.20 8
1057 [ 一日30分 인생승리의 학습법] 프로그래밍 언어별 딥러닝 라이브러리 정리 file 졸리운_곰 2021.11.19 30
1056 [오픈소스 라이센스 상용화 라이센스 검토] [Software] 공개 SW 라이센스(GPL, LGPL, BSD) 졸리운_곰 2021.11.18 10
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED