SchoolLinux is a gamified educational platform designed for teaching Linux terminal commands in a classroom environment. The system enables teachers to conduct interactive treasure-hunt games where students use Linux command-line skills to locate hidden "treasures" within dynamically generated directory structures on their local machines.
The application implements a client-server architecture with the following components:
- Backend Server: FastAPI-based REST API with WebSocket support for real-time communications
- Frontend Client: React-based single-page application with TypeScript
- SSH Automation: Paramiko library for remote environment provisioning
- State Persistence: Pickle-based serialization for system state management
- Registration Phase: Students register via browser, system extracts IP addresses from connection metadata
- Deployment Phase: Server generates unique game environments and deploys them to student machines via SSH
- Gameplay Phase: Real-time bidirectional communication via WebSockets for submission and status updates
- Completion Phase: Results aggregation and CSV export for grade assignment
- Python 3 - Core programming language
- FastAPI - Asynchronous web framework with automatic API documentation
- Socket.IO - WebSocket implementation for real-time client-server communication
- Paramiko - SSHv2 protocol library for remote command execution
- Pydantic - Data validation using Python type annotations
- Pickle - Native Python object serialization for persistent storage
- React 19 - Component-based UI framework
- TypeScript - Type-safe JavaScript superset
- Vite - High-performance build tool and development server
- Axios - Promise-based HTTP client
- Socket.IO Client - Real-time bidirectional event-based communication
- React Data Grid - Efficient data table rendering for teacher dashboard
- Font Awesome - Icon library for UI elements
- Operating System: Linux-based (tested on МОС 12)
- Python: 3.8 or higher
- Node.JS: Latest version is recommended
- Network: Local network connectivity to student machines
- Ports: 8000 (API), 4000 (optional, for frontend).
- Operating System: Linux with SSH server installed and running
- SSH: OpenSSH server configured and accessible
- User Account: Unified credentials (same username/password) for remote access
- Browser: Modern web browser with JavaScript and WebSocket support
Ensure Python and Node.JS are correctly installed and work on teacher's computer.
Ensure OpenSSH servers are installed and open on port 22 with proper firewall configuration on students' computers.
Ensure teacher's computer and students' computers are in the same LAN (Local Area Network)
git clone https://github.com/A2020GK/SchoolLinux.git
cd SchoolLinux# Create Python Venv Enviroment
python -m venv .venv
source ./.venv/bin/activate # Or anything else on different OSs
# Install Python dependencies
pip install -r requirements.txt
# Create environment configuration file
cat > .env << EOF
SSH_USER=your_ssh_username
SSH_PASSWORD=your_ssh_password
EOFcd frontend
# Install Node.js dependencies
npm install# From project root directory
fastapi run . --host 0.0.0.0
# Serve frontend (from frontend directory)
npx vite --host 0.0.0.0 --port 4000Students access the application by navigating to http://<teacher_ip>:<port (4000)> in their browsers.
Game files are placed on students' computers in /home/<user>/Game
The system generates a unique game environment for each student consisting of:
- Directory Structure: 125 directories organized in a 3-level hierarchy (5×5×5 tree)
- File Distribution: 30 randomly placed text files across the directory tree
- Treasure Files: 5 files containing treasure strings (format:
klad:<word1> <word2> <word3>) - Compression: Approximately 50% of files are GZIP-compressed (
.gz), with 2 treasure files guaranteed to be compressed - Decoy Content: Each file contains 20 lines of random English words to increase search complexity
Students must utilize Linux terminal commands to:
- Navigate the directory tree (
cd,ls,pwd) - View file contents (
cat,less,more) - Decompress GZIP files (
gunzip,zcat) - Search within files (
grep,find) - Locate and submit treasure strings via the web interface
- Points per Treasure: 1 point
- Maximum Score: 5 points
- Duplicate Prevention: Each treasure can only be submitted once
- Real-time Updates: Teacher dashboard displays live progress for all students
GET /info- Retrieve system status and client role- Response:
{ isTeacher: boolean, status: "reg" | "init" | "run" }
- Response:
GET /students- List all registered students (teacher only)GET /students/me- Retrieve current student's informationPOST /students/reg- Register a new student- Body:
{ pc: string, name: string } - Validates SSH connectivity before registration
- Body:
POST /students/logout- Unregister current studentPOST /students/kick/{ip}- Remove specified student (teacher only)
POST /game/start- Initialize and deploy game environments (teacher only)- Transitions status:
reg→init→run - Generates unique environments for all registered students
- Transitions status:
POST /game/stop- Terminate game and export results (teacher only)- Returns: CSV-formatted results
- Format:
IP;Computer;Name;Treasures
POST /game/klad- Submit found treasure- Body:
{ value: string } - Validates treasure belongs to submitter's environment
- Body:
info- Broadcast status changes to all connected clients- Payload:
{ status: string }
- Payload:
students- Update student list (teacher only)- Payload:
Record<string, Student>
- Payload:
update- Update individual student data- Payload:
{ pc: string, name: string, klads: number }
- Payload:
connect- Establish WebSocket connection- IP address extraction from connection metadata
disconnect- Handle client disconnection
The application uses Python's pickle module for serialization:
@dataclass
class Student:
pc: str # Computer identifier
name: str # Student full name
klads: set # Set of unredeemed treasures
@dataclass
class Data:
students: dict # IP address → Student mapping
status: str # System state: "reg" | "init" | "run"State is persisted to data.pkl and survives server restarts, enabling:
- Multiple game sessions without re-registration
- Recovery from unexpected server failures
- Audit trail for completed games
- SSH credentials stored in environment variables (
.envfile) - System assumes trusted local network environment (classroom LAN)
- Teacher access based on IP address (
127.0.0.1check) - No authentication mechanism for web interface
- Ensure firewall rules permit:
- SSH (port 22) from teacher machine to all student machines
- HTTP (port 8000 or configured port) from student browsers to teacher machine
- All machines must be on the same network for IP-based identification
The system has been tested in real classroom environments using:
- Distribution: МОС Linux 12 (Moscow Education Operating System)
- Class Size: Multiple sessions with 20-30 students
- Hardware: Standard school computer laboratory equipment
- Timer Functionality: Time limit enforcement not implemented; requires manual game termination by teacher
- Scalability: Designed for single classroom (20-30 concurrent users)
- SSH Dependency: Requires pre-configured SSH access on all student machines
- Error Handling: Limited feedback for network or SSH connectivity issues
Potential enhancements identified from user feedback:
- Integrated Tutorial Module: Built-in Linux command reference for teachers and students
- Multiple Game Modes:
- Reverse challenge: students hide treasures for others to find
- Competitive mode: first to find treasure claims points
- Advanced Configuration:
- Adjustable difficulty settings (directory depth, file count)
- Custom treasure patterns and content
- Timer Implementation: Automatic game termination with configurable duration
- Enhanced Analytics: Detailed statistics on command usage and student performance patterns
SchoolLinux/
├── __init__.py # FastAPI application initialization and WebSocket setup
├── data.py # Data models and persistence layer
├── game.py # Game logic and treasure validation
├── generator.py # Environment generation and SSH deployment
├── info.py # System information endpoints
├── ssh.py # SSH client wrapper
├── students.py # Student registration and management
├── utils.py # Utility functions and base schemas
├── words.txt # Word list for content generation
├── requirements.txt # Python dependencies
└── frontend/ # React frontend application
├── src/
│ ├── App.tsx # Main application component
│ ├── Teacher.tsx # Teacher dashboard interface
│ ├── Student.tsx # Student game interface
│ ├── api.ts # API client configuration
│ └── ...
├── package.json # Node.js dependencies
└── vite.config.ts # Build configuration
The system is designed for a two-phase lesson structure:
-
Theory Phase (15-20 minutes)
- Teacher introduces Linux terminal concepts
- Demonstrates essential commands with examples
- Explains game objectives and rules
-
Practice Phase (20-30 minutes)
- Students apply learned commands in competitive environment
- Gamification motivates exploration and experimentation
- Immediate feedback through scoring system
Students will be able to:
- Navigate Linux filesystem hierarchy
- Use basic file viewing commands (
cat,less,head,tail) - Search file contents with
grep,findand regular expressions - Work with compressed files (
gzip,gunzip,zcat) - Understand command composition and piping
This project was developed as a school educational tool for teaching Linux terminal skills in Russian educational institutions. Special thanks to the teachers who participated in testing and provided valuable feedback for system improvements.
For issues, feature requests, or contributions, please visit the GitHub repository. Developed by Antony Karasev (A2020GK)