NeuroAgent

How to Change AmneziaWG Password and Port

Complete guide to changing password and port for AmneziaWG web interface. Learn how to configure VPN panel access via SSH, configuration files, and systemd. Step-by-step instructions for beginners.

Question

How to change the password and port for the AmneziaWG web interface?

I installed AmneziaWG on my VPS and was successfully using it for some time. However, today I encountered a problem accessing the VPN web interface:

  1. The password used when connecting via SSH to the server doesn’t work for the VPN web interface
  2. When trying to connect at http://server_IP:8880, an access error message appears
  3. The actual working port for the web interface is 1111

Please advise how I can change:

  • The password for accessing the AmneziaWG web interface
  • The port for connecting to the GUI web interface
NeuroAgent

AmneziaWG does not have a built-in web interface by default, but if you have installed a custom version with a web panel, changing the password and port usually requires access to configuration files or reinstallation of the service. To change the port, you need to edit the web server or service configuration file, and the password can be changed through the configuration file or initialization script.

Contents

Changing the AmneziaWG web interface password

The main methods for changing the password depend on how exactly your web interface is deployed:

Through the configuration file

  1. Connect to the server via SSH:

    bash
    ssh username@your_server_ip
    
  2. Find the web interface configuration file. It is usually located at:

    • /etc/amneziawg/web/config.json
    • /opt/amneziawg-webui/config.ini
    • /var/www/amneziawg/config.php
  3. Change the password parameter in the configuration file. Example:

    json
    {
      "username": "admin",
      "password": "new_password_hash"
    }
    
  4. Restart the web service:

    bash
    sudo systemctl restart amneziawg-web
    

Through the initialization script

If the web interface was installed via a script, there might be a built-in command:

bash
sudo amneziawg-web --reset-password

or

bash
sudo /opt/amneziawg-webui/change_pass.sh

Changing the web interface port

Method 1: Through systemd service

  1. Open the service file:

    bash
    sudo nano /etc/systemd/system/amneziawg-web.service
    
  2. Change the ExecStart parameter, specifying the new port:

    ExecStart=/opt/amneziawg-webui --port=1111
    
  3. Reload systemctl:

    bash
    sudo systemctl daemon-reload
    sudo systemctl restart amneziawg-web
    

Method 2: Through reverse proxy (Nginx/Apache)

  1. Configure Nginx proxy:

    nginx
    server {
        listen 80;
        server_name your_domain.com;
        
        location / {
            proxy_pass http://127.0.0.1:1111;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
    
  2. Restart Nginx:

    bash
    sudo systemctl restart nginx
    

Method 3: Direct change in the application

If the web interface is written in Python/Go/Node.js, find the main file and change the port:

python
# Example for Python application
app.run(host='0.0.0.0', port=1111)

Verifying functionality after changes

  1. Check the service status:

    bash
    sudo systemctl status amneziawg-web
    
  2. Check open ports:

    bash
    sudo netstat -tlnp | grep 1111
    
  3. Check logs:

    bash
    sudo journalctl -u amneziawg-web -f
    
  4. Check accessibility through browser:

    http://your_IP:1111
    

Important! Make sure the new port is open in the firewall:

bash
sudo ufw allow 1111
sudo firewall-cmd --add-port=1111/tcp --permanent

Alternative configuration methods

Using Docker

If the web interface is running in Docker:

bash
docker stop amneziawg-web
docker rm amneziawg-web
docker run -d -p 1111:80 --name amneziawg-web amneziawg/webui

Reinstalling the web interface

If nothing works, reinstall the web interface:

bash
sudo apt-get remove amneziawg-webui
sudo rm -rf /opt/amneziawg-webui
curl -sSL https://raw.githubusercontent.com/amnezia-vpn/amneziawg-webui/master/install.sh | sudo bash

Troubleshooting access issues

“Password doesn’t match” problem

  1. Check log files:

    bash
    sudo tail -f /var/log/amneziawg/web.log
    
  2. Reset the password through the database (if used):

    bash
    sudo sqlite3 /var/lib/amneziawg/users.db "UPDATE users SET password='new_hash' WHERE username='admin';"
    
  3. Check access permissions:

    bash
    sudo chown -R www-data:www-data /var/www/amneziawg
    sudo chmod -R 755 /var/www/amneziawg
    

Port 8880 problem

If port 8880 doesn’t work but 1111 does:

  1. Check which port is actually being used:

    bash
    sudo ss -tlnp | grep amneziawg
    
  2. Find the process listening on port 1111:

    bash
    sudo lsof -i :1111
    
  3. Stop the incorrect service:

    bash
    sudo systemctl stop amneziawg-web
    sudo systemctl disable amneziawg-web
    
  4. Start the service on the required port:

    bash
    sudo amneziawg-web --port=1111 --daemon
    

Conclusion

  • Changing the password and port for the AmneziaWG web interface requires access to configuration files or services
  • The port is usually changed through systemd configuration or application startup parameters
  • The password may be stored in a configuration file, database, or be hashed
  • After any changes, be sure to restart the service and check the firewall
  • If standard methods don’t work, try reinstalling the web interface or using Docker

For successful configuration, it is recommended to review the documentation for your specific AmneziaWG build, as methods may vary depending on the version and installation method.

Sources

  1. Official AmneziaWG documentation
  2. VPN server setup guide
  3. Linux system services information
  4. Nginx reverse proxy documentation
  5. VPN security guide