Skip to content

How to switch the 12Port service owner to a non-root user (Linux)

As stated in the installation guide, it is best practice to install the 12Port application as a non-root user when hosting on Linux. However, if you have already installed the software as root, it is still possible to switch the owner of the 12Port service to a non-root user with the following procedure.

  1. Stop the 12Port and 12Port Gateway services.

    sudo systemctl stop 12port.service
    sudo systemctl stop 12port-gw.service
    
  2. Edit the 12Port system service file /etc/systemd/system/12port.service and define the User option under the [Service] header to match your new target user.

    [Service]
    User=mytpuser
    
  3. Reload the service files.

    sudo systemctl daemon-reload
    
  4. Change the ownership of the 12Port installation directory (typically /opt/12port) to your new target user.

    sudo chown -R mytpuser /opt/12port
    
  5. Restart the 12Port and 12Port Gateway services.

    sudo systemctl start 12port.service
    sudo systemctl start 12port-gw.service