███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗██╗ ██╗
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██║ ██║
█████╗ ███████║███████╗ ╚████╔╝ ██████╔╝███████╗███████║
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ██╔══██╗╚════██║██╔══██║
███████╗██║ ██║███████║ ██║ ██║ ██║███████║██║ ██║
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
Easy Remote Shell Server v1.0
A C++ TCP client–server command execution system that allows a remote client to connect to a server and execute shell commands securely using SHA-256 + Salt password authentication via OpenSSL.
This system includes:
server: Remote command server (authentication + command execution)client: Remote client for sending commandsadduser: Utility tool to add users into the user database (users.txt)
- TCP socket-based client–server communication
- Secure Authentication using OpenSSL
- SHA-256 hashing with random salt
- User credentials stored as:
username:salt:hash - Session tokens issued after successful login
- Token-based command authorization
- Remote command execution
- Executes shell commands on the server and returns output
- Supports
cd <path>(directory switching handled specially) - Real-time output capture via pipes
- Multi-client support
- Fork-based process model
- Concurrent client handling
- Automatic zombie process cleanup
os-assignment/
│
├── include/
│ ├── Auth.h # Authentication & hashing logic
│ ├── Client.h # Client class interface
│ ├── CommandExecutor.h # Command execution handler
│ ├── Colors.h # Terminal color codes
│ ├── Server.h # Server class interface
│ └── Socket.h # RAII socket wrapper
│
├── src/
│ ├── socket/
│ │ └── Socket.cpp # Socket implementation
│ │
│ ├── server/
│ │ ├── Auth.cpp # SHA-256 + Salt authentication
│ │ ├── CommandExecutor.cpp # Fork/exec/pipe command handling
│ │ ├── Server.cpp # Server logic & client handling
│ │ ├── server_main.cpp # Server entry point
│ │ └── adduser_main.cpp # User creation utility
│ │
│ └── client/
│ ├── Client.cpp # Client implementation
│ └── client_main.cpp # Client entry point
│
├── data/
│ └── users.txt # User database (salt:hash)
│
├── build/ # Compiled binaries
├── Makefile # Build configuration
├── README.md # This file
├── ARCHITECTURE.md # Detailed design document
└── README_DETAILED.md # Extended documentation
- C++17
- POSIX TCP sockets
- OpenSSL (
libssl,libcrypto) - pthread / concurrency support
- Linux system APIs (
fork,exec,pipe,waitpid,chdir,getcwd)
- Linux recommended (Ubuntu / Debian)
g++with C++17 support
Install OpenSSL dev package:
sudo apt update
sudo apt install build-essential libssl-dev makeBuild all components:
makeClean and rebuild:
make clean allBuild specific targets:
make server
make client
make adduserBefore connecting, create at least one user:
./adduser <username> <password>Example:
./adduser admin password123This will write credentials to:
data/users.txt
./server # Run in single-process mode
./server --fork # Run with fork-based multi-client support (recommended)./clientEnter username: admin
Enter password: ********
Authentication successful!
Remote Shell> ls
Remote Shell> pwd
Remote Shell> cd /tmp
Remote Shell> exit
- Connection: Client connects to server
- Credentials: Client sends
username:password - Verification: Server:
- Retrieves stored salt for username
- Computes SHA-256 hash of
salt + password - Compares with stored hash
- Response: Server returns:
- ✅
AUTH_SUCCESS <session_token>on success - ❌
AUTH_FAILED <reason>on failure
- ✅
- Authorization: All subsequent commands require valid token
After authentication, you can run commands like:
ls
pwd
whoami
date
uname -acd /home
cd ..
cd ~/Downloads✅ Implemented:
- Passwords are not stored in plaintext
- Salted SHA-256 hashing via OpenSSL
- TLS encryption for all communication
- Argon2/bcrypt for stronger password hashing
- Command sandboxing / allowlist
- Rate limiting and auditing logs
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas we'd especially appreciate help with:
- 🔒 Security enhancements (TLS/SSL, stronger hashing)
- 🧪 Testing (unit tests, integration tests)
- 📚 Documentation improvements
- 🚀 Performance optimizations
This project is licensed under the MIT License - see the LICENSE file for details.
- Built using OpenSSL for cryptographic operations
- Inspired by traditional Unix remote shell utilities
- Demonstrates OS concepts: processes, IPC, sockets, and authentication