🤖 A lightweight Telegram bot for remote server administration. Install it on any server and control it remotely through Telegram.
- 🖥️ System Information: Get CPU, memory, disk usage, and system stats
- 📁 File Management: Browse directories, view files, download/upload files
- 🔧 Process Management: List, start, stop, and monitor processes
- 📊 System Monitoring: Real-time system metrics and alerts
- 🔐 Secure Access: User authentication and command authorization
- 📝 Command Execution: Run shell commands with output capture
- 🚨 Service Management: Start/stop/restart system services
- 📈 Resource Monitoring: Track system resources over time
- 🔄 Auto-updates: Keep the bot updated with latest features
- 📱 Mobile-friendly: Rich inline keyboards for easy mobile use
You can either download a pre-built binary or build from source.
Linux (AMD64)
# Download the release (replace v1.0.0 with the latest version)
wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-amd64.tar.gz
# Extract
tar -xzf server-admin-bot-linux-amd64.tar.gz
# Move to system path
sudo mv server-admin-bot-linux-amd64 /usr/local/bin/server-admin-bot
# Make executable
sudo chmod +x /usr/local/bin/server-admin-botLinux (ARM64)
# Download the release (replace v1.0.0 with the latest version)
wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-arm64.tar.gz
# Extract
tar -xzf server-admin-bot-linux-arm64.tar.gz
# Move to system path
sudo mv server-admin-bot-linux-arm64 /usr/local/bin/server-admin-bot
# Make executable
sudo chmod +x /usr/local/bin/server-admin-botmacOS (Intel)
# Download the release (replace v1.0.0 with the latest version)
curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-amd64.tar.gz -o server-admin-bot-darwin-amd64.tar.gz
# Extract
tar -xzf server-admin-bot-darwin-amd64.tar.gz
# Move to system path
sudo mv server-admin-bot-darwin-amd64 /usr/local/bin/server-admin-bot
# Make executable
sudo chmod +x /usr/local/bin/server-admin-botmacOS (Apple Silicon)
# Download the release (replace v1.0.0 with the latest version)
curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-arm64.tar.gz -o server-admin-bot-darwin-arm64.tar.gz
# Extract
tar -xzf server-admin-bot-darwin-arm64.tar.gz
# Move to system path
sudo mv server-admin-bot-darwin-arm64 /usr/local/bin/server-admin-bot
# Make executable
sudo chmod +x /usr/local/bin/server-admin-botWindows (AMD64)
# Download the release (replace v1.0.0 with the latest version) using PowerShell
Invoke-WebRequest -Uri "https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-windows-amd64.zip" -OutFile "server-admin-bot-windows-amd64.zip"
# Extract (using PowerShell)
Expand-Archive -Path server-admin-bot-windows-amd64.zip -DestinationPath .
# Run the executable
.\server-admin-bot-windows-amd64.exe -config config.yamlNote: Replace
v1.0.0with the latest version tag. Check the releases page for available versions.
# Clone the repository
git clone https://github.com/RusEu/RadminTelegramBot.git
cd RadminTelegramBot
# Install Go dependencies
go mod download
# Build the binary
go build -o server-admin-bot ./cmd/bot/main.go
# Move to system path (Linux/macOS)
sudo mv server-admin-bot /usr/local/bin/
# Make executable (Linux/macOS)
sudo chmod +x /usr/local/bin/server-admin-bot# Create config directory
sudo mkdir -p /etc/server-admin-bot
# Create configuration file
sudo nano /etc/server-admin-bot/config.yamlAdd your configuration:
telegram:
bot_token: "YOUR_BOT_TOKEN_HERE"
allowed_users:
- 123456789 # Your Telegram user ID
- 987654321 # Additional user ID
security:
admin_password: "your_secure_admin_password"
session_timeout: 3600 # 1 hour
max_file_size: 52428800 # 50MB
server:
name: "Production Server 1"
timezone: "UTC"
log_level: "info"
monitoring:
cpu_alert_threshold: 85
memory_alert_threshold: 90
disk_alert_threshold: 95Create a systemd service file (Linux only):
# Create service file
sudo nano /etc/systemd/system/server-admin-bot.serviceAdd service configuration:
[Unit]
Description=Remote Server Admin Bot
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/etc/server-admin-bot
ExecStart=/usr/local/bin/server-admin-bot -config /etc/server-admin-bot/config.yaml
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target# Reload systemd
sudo systemctl daemon-reload
# Enable and start the service
sudo systemctl enable server-admin-bot
sudo systemctl start server-admin-bot
# Check status
sudo systemctl status server-admin-botFor macOS, create a Launch Agent:
# Create LaunchAgents directory if it doesn't exist
mkdir -p ~/Library/LaunchAgents
# Create launch agent plist file
nano ~/Library/LaunchAgents/com.radmin.telegrambot.plistAdd the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.radmin.telegrambot</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/server-admin-bot</string>
<string>-config</string>
<string>/etc/server-admin-bot/config.yaml</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/server-admin-bot.err</string>
<key>StandardOutPath</key>
<string>/tmp/server-admin-bot.out</string>
</dict>
</plist>Load and start the agent:
# Load the agent
launchctl load ~/Library/LaunchAgents/com.radmin.telegrambot.plist
# Start the agent
launchctl start com.radmin.telegrambot
# Check status
launchctl list | grep radminFor Windows, you can run the bot as a service using NSSM (Non-Sucking Service Manager) or Task Scheduler:
Using NSSM:
# Download NSSM from https://nssm.cc/download
# Extract nssm.exe to a directory
# Install the service
.\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe" "-config" "C:\Path\To\config.yaml"
# Start the service
.\nssm.exe start ServerAdminBot
# Check service status
.\nssm.exe status ServerAdminBotUsing Task Scheduler:
- Open Task Scheduler
- Create a new task
- Set trigger to "At startup"
- Set action to start the program:
server-admin-bot-windows-amd64.exe - Add argument:
-config C:\Path\To\config.yaml - Configure to run whether user is logged on or not
- Save and run the task
- Message @BotFather on Telegram
- Send
/newbotcommand - Choose a name and username for your bot
- Copy the bot token from BotFather's response
- Add the token to your
config.yaml
- Message @userinfobot on Telegram
- The bot will reply with your user ID
- Add your user ID to the
allowed_userslist inconfig.yaml
/start- Initialize the bot and show main menu/status- Show system status overview/info- Detailed system information/uptime- System uptime and load/resources- CPU, Memory, Disk usage
/processes- List running processes/kill <pid>- Kill a process by ID/services- Manage system services/top- Show top processes by resource usage
/ls [path]- List directory contents/pwd- Show current directory/cat <file>- Display file contents/download <file>- Download file from server/upload- Upload file to server/df- Show disk usage
/reboot- Reboot the server (requires confirmation)/shutdown- Shutdown the server (requires confirmation)/logs [lines]- Show system logs/exec <command>- Execute shell command
/alerts- Show active alerts/monitor- Start/stop real-time monitoring/stats- Show performance statistics/network- Network interface information
bot_token: Your Telegram bot tokenallowed_users: List of authorized user IDs
admin_password: Password for sensitive operationssession_timeout: Session timeout in secondsmax_file_size: Maximum file upload size in bytes
name: Server name for identificationtimezone: Server timezonelog_level: Logging level (debug, info, warn, error)
cpu_alert_threshold: CPU usage alert threshold (%)memory_alert_threshold: Memory usage alert threshold (%)disk_alert_threshold: Disk usage alert threshold (%)
- ✅ User Authentication: Only authorized users can access the bot
- ✅ Command Authorization: Sensitive commands require additional confirmation
- ✅ Session Management: Automatic session timeouts
- ✅ Input Validation: All inputs are validated and sanitized
- ✅ Rate Limiting: Prevents command spam and abuse
- ✅ Audit Logging: All commands and actions are logged
- Go 1.21 or later
- Git
# Clone the repository
git clone https://github.com/RusEu/RadminTelegramBot.git
cd RadminTelegramBot
# Install dependencies
go mod download
# Build for current platform
go build -o server-admin-bot ./cmd/bot/main.go# Linux AMD64
GOOS=linux GOARCH=amd64 go build -o server-admin-bot-linux-amd64 ./cmd/bot/main.go
# Linux ARM64
GOOS=linux GOARCH=arm64 go build -o server-admin-bot-linux-arm64 ./cmd/bot/main.go
# Windows AMD64
GOOS=windows GOARCH=amd64 go build -o server-admin-bot-windows-amd64.exe ./cmd/bot/main.go# Service logs
sudo journalctl -u server-admin-bot -f
# Log file (if configured)
tail -f /var/log/server-admin-bot.logBot not responding:
- Check if the service is running:
systemctl status server-admin-bot - Verify bot token is correct
- Ensure your user ID is in the allowed_users list
Permission errors:
- Run bot as root for full system access
- Check file permissions on config and executable
Network issues:
- Verify internet connectivity
- Check firewall rules for outbound HTTPS (443)
.
├── cmd/
│ └── bot/
│ └── main.go # Application entry point
├── internal/
│ ├── bot/
│ │ ├── bot.go # Main bot logic
│ │ ├── handlers.go # Command handlers
│ │ └── middleware.go # Authentication middleware
│ ├── config/
│ │ └── config.go # Configuration management
│ ├── system/
│ │ ├── info.go # System information
│ │ ├── process.go # Process management
│ │ ├── files.go # File operations
│ │ └── monitoring.go # System monitoring
│ ├── security/
│ │ ├── auth.go # Authentication
│ │ └── validation.go # Input validation
│ └── utils/
│ ├── logger.go # Logging utilities
│ └── helpers.go # Helper functions
├── configs/
│ └── config.example.yaml # Example configuration
├── scripts/
│ ├── install.sh # Installation script
│ └── uninstall.sh # Uninstallation script
├── go.mod
├── go.sum
├── Makefile
└── README.md
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
See CHANGELOG.md for a list of changes in each version.
⚡ Made with Go - Fast, reliable, and lightweight server administration at your fingertips!