# 14: Webmin - Visual Server Management

Webmin is a web-based interface for managing your Linux server. Instead of using the command line, you can manage users, services, files, system settings, and more through a friendly web browser interface. Think of it as a control panel for your entire server.

For advanced features, module documentation, and detailed guides, see the [official Webmin documentation](https://webmin.com/documentation.html).

## Why Webmin?

- ✅ **Visual server management** - Manage your server without command line
- ✅ **User management** - Create, edit, and manage user accounts visually
- ✅ **File browser** - Browse and edit files with a web interface
- ✅ **Service management** - Start, stop, and configure system services
- ✅ **System monitoring** - View system resources and logs
- ✅ **Package management** - Install and update software packages
- ✅ **Network configuration** - Configure network settings

## Prerequisites

- ✅ **Docker running** (from Chapter 3)
- ✅ **Optional: Traefik installed** (from Chapter 4) for HTTPS access with a domain
- ✅ **Optional: Subdomain** (from Chapter 4.5), e.g., `webmin.yourdomain.com`

**Note:** Webmin is typically accessed via SSH tunnel for security. The installation script will guide you through this. Traefik mode is optional and allows direct web access.

## Step 1: Start Infinity Tools

```
sudo infinity-tools
```

## Step 2: Install Webmin

1. Go to **📱 APPLICATIONS**
2. Select **Webmin**
3. Choose **Install Webmin**

### Using the Infinity Tools GUI

- Use **↑/↓** to move, **Enter** to select, **Esc** to go back
- Look for the **turquoise cursor** indicating the current selection
- Each screen shows a short description at the top explaining what's needed

### Step 2.1: Choose SSL Mode

You'll see two options. Here's what each means:

- **Traefik (optional)**
    - **What it is:** Uses your domain name with a trusted HTTPS certificate from Let's Encrypt
    - **What you need:** A subdomain (e.g., `webmin.yourdomain.com`) pointing to your server (see Chapter 4.5)
    - **What you get:** Direct web access at `https://webmin.yourdomain.com`
    - **Pick this if:** You want direct web access without SSH tunneling
- **Standalone (recommended)**
    - **What it is:** Uses HTTPS with a self-signed certificate, accessed via SSH tunnel
    - **What you need:** SSH access to your server
    - **What you get:** Secure access via SSH tunnel (more secure than direct web access)
    - **Pick this if:** You want the most secure setup (recommended)

**Simple rule of thumb:** Use **Standalone** for security (SSH tunnel), or **Traefik** if you want direct web access.

### Step 2.2: If You Choose Traefik

1. Enter your subdomain, e.g., `webmin.yourdomain.com`
2. Ensure the subdomain's DNS A record points to your server (see Chapter 4.5)
3. Infinity Tools will configure HTTPS automatically via Let's Encrypt

**After install:** Your Webmin will be available at `https://webmin.yourdomain.com`

### Step 2.3: If You Choose Standalone

1. Pick a port (default: 8443)
2. You'll access Webmin via SSH tunnel (instructions shown after installation)

### Step 2.4: Host Filesystem Access

You'll be asked about host filesystem access. This controls whether Webmin can browse files on your actual server (not just inside the container).

- **No (default)**
    - **What it is:** Webmin can only browse files inside its own container
    - **Pick this if:** You want maximum security and only need Webmin for system management (not file browsing)
- **Yes (Read-Only)**
    - **What it is:** Webmin can browse host files at `/host/` but cannot edit them
    - **Pick this if:** You want to view server files safely without risk of accidental changes
- **Yes (Read-Write)**
    - **What it is:** Webmin can browse AND edit host files at `/host/`
    - **Pick this if:** You want full file management capabilities
    - **⚠️ Warning:** This gives Webmin full access to your server's filesystem - use with caution!

### What Happens During Installation

- Webmin container is created
- System user `webminadmin` is created with a random password
- Data directory is set up at `/opt/speedbits/webmin`
- Optional domain + Traefik HTTPS routing (if using Traefik)
- Service starts and becomes accessible

## Step 3: Access Webmin

### If Using Traefik

1. Wait 30-60 seconds for SSL certificate generation
2. Open `https://webmin.yourdomain.com` in your browser
3. Login with the credentials shown after installation

### If Using Standalone (SSH Tunnel)

**⚠️ IMPORTANT:** Webmin requires an SSH tunnel for secure access. You cannot access it directly from the internet.

**On your local computer** (not the server), run:

```
ssh -L 8443:localhost:10000 your-username@your-server-ip
```

Replace:

- `your-username` - Your SSH username
- `your-server-ip` - Your server's IP address
- `8443` - The port you chose during installation (or default 8443)

Then in your browser, open:

```
https://localhost:8443
```

You'll see a security warning (normal for self-signed certificates). Click "Advanced" → "Proceed" to continue.

## Step 4: Login to Webmin

After installation, you'll see credentials like:

- **Username:** `webminadmin`
- **Password:** A randomly generated password (shown only once!)

**⚠️ CRITICAL:** Write down or save this password immediately! It will NOT be shown again. Use a password manager (like Vaultwarden from Chapter 7) to store it securely.

### Login Steps

1. Enter username: `webminadmin`
2. Enter the password shown after installation
3. Click "Login"

**Note:** Any user with sudo privileges can also login to Webmin using their system username and password.

## Step 5: Understanding the File Manager

**⭐ IMPORTANT:** When you first open Webmin's File Manager, you're browsing files **inside the Webmin container**, not your actual server!

### How to Access Host System Files

To browse files on your actual server (the host system), you need to navigate to the `/host/` folder:

1. Go to **Other** → **File Manager** in Webmin
2. You'll see the container's filesystem (usually empty or minimal)
3. **To access host files:** Type `/host/` in the path bar at the top
4. Press Enter or click "Go"
5. Now you'll see your actual server's filesystem!

### Understanding the Path Structure

- **Container files:** `/` (root of container)
- **Host files:** `/host/` (mounted host filesystem)

### Examples

- **Host home directories:** Navigate to `/host/home/`
- **Host system logs:** Navigate to `/host/var/log/`
- **Host Docker data:** Navigate to `/host/opt/`
- **Host Infinity Tools:** Navigate to `/host/opt/InfinityTools/`
- **Host Speedbits data:** Navigate to `/host/opt/speedbits/`

**💡 Tip:** Bookmark `/host/` or add it to your favorites in Webmin for quick access!

### File Access Modes

Depending on what you chose during installation:

- **Read-Only:** You can view files at `/host/` but cannot edit or delete them
- **Read-Write:** You can view, edit, create, and delete files at `/host/`
- **No Access:** The `/host/` folder won't exist - you can only browse container files

## What You Can Do in Webmin

### System Management

- 👥 **User Management** - Create, edit, delete user accounts
- 🔐 **Password Management** - Change user passwords
- ⚙️ **Service Management** - Start, stop, restart system services
- 📦 **Package Management** - Install and update software

### File Management

- 📁 **File Browser** - Browse and edit files (remember to use `/host/` for host files!)
- 📝 **Text Editor** - Edit configuration files
- 📤 **File Upload/Download** - Transfer files to/from server

### Monitoring

- 📊 **System Information** - View CPU, memory, disk usage
- 📋 **Log Viewer** - View system logs
- 🌐 **Network Configuration** - Configure network settings

## Security Recommendations

- ✅ **Use SSH tunnel** - Standalone mode with SSH tunnel is more secure than direct web access
- ✅ **Strong password** - The generated password is strong, but you can change it in Webmin
- ✅ **Store credentials securely** - Use a password manager (Vaultwarden recommended!)
- ✅ **Limit filesystem access** - Use "Read-Only" unless you need to edit files
- ✅ **Regular updates** - Keep Webmin updated for security patches
- ⚠️ **Protect access** - Webmin has powerful system management capabilities - keep it secure!

## Troubleshooting

### Can't Access Webmin

- **Traefik mode:** Wait 30-60 seconds after installation for SSL certificate generation
- **Standalone mode:** Make sure you're using SSH tunnel (not direct access)
- **Check container status:** Run `docker ps | grep webmin` to see if it's running
- **Check logs:** Run `docker logs webmin` to see error messages

### Can't Login

- Make sure you're using the correct username: `webminadmin`
- Check that you saved the password correctly (it's shown only once!)
- Try logging in with a system user that has sudo privileges
- Check if user exists: `docker exec webmin grep webminadmin /etc/passwd`

### Can't See Host Files

- **Remember:** You must navigate to `/host/` in the File Manager path bar
- If `/host/` doesn't exist, you chose "No" for host filesystem access during installation
- To enable it, reinstall Webmin and choose "Yes (Read-Only)" or "Yes (Read-Write)"
- Check installation: Look for `/host` in the docker-compose.yml file

### SSH Tunnel Not Working

- Make sure SSH is working: `ssh your-username@your-server-ip`
- Check the port number matches what you chose during installation
- Try using the container IP directly: `ssh -L 8443:CONTAINER_IP:10000 user@server`
- Check Webmin is running: `docker ps | grep webmin`

## Where to Find Webmin After Install

- On the finish screen, Infinity Tools prints the access URL and SSH tunnel command
- You can also see it in **📊 STATUS &amp; HEALTH → STATUS**
- Check the installation directory: `/opt/speedbits/webmin`
- View credentials: The password is shown only once during installation - save it!

## You're Ready!

Webmin is now installed and ready to use. You can manage your Linux server visually through the web interface. Remember:

- ⭐ Use `/host/` in File Manager to access your actual server files
- 🔐 Save your login credentials securely
- 🔒 Use SSH tunnel for the most secure access

**Next steps:** Explore Webmin's features, manage your server users, browse files, and configure system settings. Webmin makes server management much easier than using the command line!