Menu

#927 Privoxy with Admin rights?

version 3.0.31
open
nobody
None
5
2022-02-04
2021-06-12
No

Hi.
Installed Privoxy 3.0.32 on Win 10, but when closing it not restart was possible.
Error message:
Privoxy Error: Fatal Error: init_error_log(): can't open logfile: '\privoxy.log'
Starting it with admin rights no errors happen.

I read no advices to use admin mode for Privoxy here with Windows 10:
http://www.privoxy.org/user-manual/startup.html
http://www.privoxy.org/user-manual/quickstart.html

thx

Related

Bugs: #927

Discussion

  • Lee

    Lee - 2021-06-12

    On 6/12/21, Clemens Ratte-Polle wrote:

    [bugs:#927] Privoxy with Admin rights?

    Status: open
    Group: version 3.0.31
    Created: Sat Jun 12, 2021 12:45 PM UTC by Clemens Ratte-Polle
    Last Updated: Sat Jun 12, 2021 12:45 PM UTC
    Owner: nobody

    Hi.
    Installed Privoxy 3.0.32 on Win 10, but when closing it not restart was
    possible.
    Error message:
    Privoxy Error: Fatal Error: init_error_log(): can't open logfile:
    '\privoxy.log'
    Starting it with admin rights no errors happen.

    I read no advices to use admin mode for Privoxy here with Windows 10:
    http://www.privoxy.org/user-manual/startup.html
    http://www.privoxy.org/user-manual/quickstart.html

    You shouldn't be using admin mode for normal use, so you've got that
    part right :)

    Privoxy logging isn't enabled by default, so there isn't a good write
    up for enabling it on windows... the assumption is that if you do
    enable logging, you know how to put the log file where everyone can
    write to it.

    https://www.privoxy.org/faq/trouble.html#FILE-PERMISSIONS
    shows how to fix file permissions.

    I like having the log file outside of the program files directory, so
    my privoxy config.txt has
    logdir C:\temp
    logfile privoxy.log

    and the permissions on \temp\privoxy.log are
    C:>cacls \temp\privoxy.log
    C:\temp\privoxy.log I3668\Lee:(ID)F
    BUILTIN\Administrators:(ID)F
    NT AUTHORITY\SYSTEM:(ID)F
    BUILTIN\Users:(ID)R
    NT AUTHORITY\Authenticated Users:(ID)C

    so anyone is allowed to write & just me (or me logged in as the admin)
    is allowed to delete.

    Suggestions for how to improve the documentation would be welcome.

    Regards
    Lee

     
    👍
    1

    Related

    Bugs: #927

  • Ben Bucksch

    Ben Bucksch - 2022-02-04

    The problem are file permissions to the log file. Privoxy is installed by the Windows installer by default in the "C:\Programs (x86)\Privoxy\" folder, and files in that directory can only be changed by admins. By default, the log file location is privoxy.log in the same install directory. So, only applications running as admins can write to the log file. This is what is causing the bug.

    Privoxy logging isn't enabled by default

    That statement is not correct. If I install Privoxy on Windows with the installer, logging is enabled by default, to the privoxy.log file in the installation directory, which can only be modified with admin rights, therefore producing the error at startup. Furthermore, the error is fatal, preventing Privoxy from running.

    The default install on Windows with the installer shows this bug here.

    It works immediately after install, because the installer runs with admin rights, and launches privoxy.exe, which then inherits the admin rights. So, the first start right after installation works. But it works only exactly once.

    No other start after that works. I tried:
    * Starting privoxy.exe manually by double-clicking on it in Windows Explorer
    * Starting "Privoxy" from the Start menu (the entry added by the installer)
    * Rebooting and autostart of Privoxy (the autostart added by the installer)

    All of them show the same fatal error message:
    Privoxy Error: Fatal Error: init_error_log(): can't open logfile: '\privoxy.log'

    The default install is broken.

     

    Last edit: Ben Bucksch 2022-02-04
  • Ben Bucksch

    Ben Bucksch - 2022-02-04

    Workaround, until the default config is fixed:

    1. Open the config.txt file with Notepad++ as administrator
    2. Select Edit | Format File ending | Unix (LF)
    3. Comment out the log file location setting, by adding a # at the start of the line:
      #logfile privoxy.log
    4. Save
    5. Start Privoxy
     

    Last edit: Ben Bucksch 2022-02-04
    • Lee

      Lee - 2022-02-04

      On 2/3/22, Ben Bucksch benb@users.sourceforge.net wrote:

      Workaround, until the default config is fixed:

      1. Open the config.txt file with Notepad++ as administrator
      2. Select Edit | Format File ending | Unix (LF)
      3. Comment out the log file location setting, by adding a # at the start
        of the line:
        #logfile privoxy
      4. Save
      5. Start Privoxy

      The workaround from the FAQ still works for me:

      Start / Windows System / right click on 'Command Prompt'
      left click on More / Run as administrator

      In the new command prompt window:
      cd "\Program Files (x86)"
      cd Privoxy

      C:\Program Files (x86)\Privoxy>cacls config.txt /g users:f
      Are you sure (Y/N)?y
      processed file: C:\Program Files (x86)\Privoxy\config.txt

      C:\Program Files (x86)\Privoxy>notepad config.txt

      -- change the "logdir ." line to "logdir C:\temp"

      -- note that I already have a c:\temp directory, you might have to
      -- mkdir c:\temp

      C:\Program Files (x86)\Privoxy>grep logdir config.txt

      2.4. logdir

      -LR- logdir .

      logdir C:\temp

      File name, relative to logdir

      C:\Program Files (x86)\Privoxy>

      Regards,
      Lee

       

Log in to post a comment.