How to run Gophish as a systemd service

Are you running gophish straight from shell and want to make sure to not close the application by mistake during a phishing assessment? Or maybe that was what led you to this article? No worries, in this article I will show you how easy it is to run it as a service with systemd instead.

If you haven’t heard about systemd before it’s simply a very popular tool used to manage services on Linux systems. A systemd service is a script that runs a specific program or command. This script is managed by systemd and can be configured to start automatically at boot time if you like.

Step-by-step guide:

I will now describe the simple steps that you need to take to create and then manage the service with systemctl:

  1. Create the service file that will tell systemd how to manage our gophish service. We create the file by opening up a new file with the text editor of your choice

    sudo vim /etc/systemd/system/gophish.service

  2. Now it’s time to enter the following text into the new file and then save it, replace WorkingDirectory and ExecStart with the location where you installed gophish:




  3. Now you want to reload the systemd manager configuration

    sudo systemctl daemon-reload

  4. Now we are ready to start the service and then make sure that the service is started:

    sudo systemctl start gophish
    sudo systemctl status gophish

  5. Now the service is running. If you want to stop the service you can simply just run:

    sudo systemctl stop gophish

  6. If you want to start the service automatically after each reboot of the machine you run:

    sudo systemctl enable gophish

It’s as simple as that. I hope this guide was helpful for you.

//Rickard Carlsson

Copyright © 2022