A modern, web-based SSH terminal accessible from any browser. Built with Flask, Socket.IO, and xterm.js.
- 🔐 Secure Authentication - Login required before accessing terminal
- 🖥️ Full Terminal Emulation - Powered by xterm.js with modern UI
- ⚡ Real-time SSH - WebSocket-based live terminal streaming
- 🎨 Modern Design - Clean, minimal interface with dark theme
- 📱 Responsive - Works on desktop and mobile browsers
- 🔓 Session Management - Multiple concurrent sessions supported
cd ssh-terminal
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtpython app.pyThe server will start on http://localhost:5002
- Username:
admin - Password:
admin123
Enter your SSH credentials (username/password) to connect to your server.
Edit app.py:
if username == 'admin' and password == 'admin123':python app.py --port 5002Or edit app.py:
socketio.run(app, host='0.0.0.0', port=5002)To expose via Cloudflare Tunnel:
# ~/.cloudflared/config.yml
tunnel: your-tunnel-name
ingress:
- hostname: ssh.safalpanta.com
service: http://localhost:5002pip install gunicorn
gunicorn -w 2 -b 0.0.0.0:5002 "app:app"Create /etc/systemd/system/ssh-terminal.service:
[Unit]
Description=SSH Terminal Web App
After=network.target
[Service]
Type=simple
User=saf
WorkingDirectory=/var/www/safalpanta.com/ssh-terminal
ExecStart=/var/www/safalpanta.com/ssh-terminal/venv/bin/python app.py
Restart=always
[Install]
WantedBy=multi-user.target
⚠️ Important: This is a development/demo implementation.
For production use:
- Use HTTPS - Always serve over HTTPS
- Strong Authentication - Use environment variables for credentials
- Rate Limiting - Add rate limiting to prevent brute force
- Session Timeout - Implement automatic session expiration
- IP Whitelisting - Restrict access to known IPs
- Two-Factor Auth - Consider adding 2FA
- Backend: Flask, Flask-SocketIO, paramiko
- Frontend: xterm.js, Socket.IO client, vanilla JavaScript
- Styling: Custom CSS with modern design system
ssh-terminal/
├── app.py # Flask app & WebSocket handlers
├── requirements.txt # Python dependencies
├── README.md # This file
├── static/
│ ├── css/
│ │ └── style.css # Main stylesheet
│ └── js/
│ └── terminal.js # Terminal logic
└── templates/
├── login.html # Login page
└── terminal.html # Terminal interface
- Make sure SSH server is running:
sudo systemctl status sshd
- Check SSH credentials
- Verify SSH key permissions if using keys
- Check browser console for errors
- Ensure JavaScript is enabled
- Clear browser cache
MIT License - feel free to use and modify.
Safal Panta - safalpanta.com