[BlueOnyx:24349] Re: CGIWrap Error: Server UserID Mismatch Error FIX

David Hahn blueonyx at sb9.com
Tue Sep 29 06:55:36 -05 2020


Hi all,
I may of found a way to run perl without errors on the 5210R.
It's not a safe fix but might help someone in a jam. Like me..
I have a server full of perl scripts i'm moving from 5106R to 5210R.

The fix:
Create a .htaccess file and add these lines to it:

===================================================
# This is ugly but it works!
# Set AllowOverride:  to 'All' in GUI.
# I know this is tabu, but what ya gonna do...
#
Options +ExecCGI
AddHandler cgi-script .cgi .pl
===================================================

Put the .htaccess file in /web of the vsite.
Switch on AllowOverride: in the GUI -->
Server Management / Web / Apache tab.
Go to AllowOverride: 'All 'and tick it. Save.
Create a file named test.pl and add this to it:

===================================================
#!/usr/bin/perl
use strict;
use warnings;
print "Content-type: text/html\n\n";
print "<title>Hello World!</title>\n";
print "Hello World!\n";
exit;
===================================================

The test:
Save, install and set to 755. This must run as the site admin user eg; 
web ownership.
Not 'nobody' or 'apache'.

Other notes:
The real important part is the script has no "Windows' carriage return" 
characters!

One of many errors I came across while testing was:
It gets weird here.. What you can't see will mess you up.

The error message "No such file or directory", doesn't come from Apache 
or from Perl.
When Apache is invoking the script, it passes the execution to the 
command line interpreter (CLI) of the system.
This CLI opens the script file and reads the first line 
"#!/usr/bin/perl" (the shebang line). If it has any line feeds
you get the error. I also tried the old -w Option switch trick. Has save 
me a few times. But it's not really needed.

When you add the option '-w' the character '\r' becomes part of the 
argument "-w\r".
The path to the Perl executable becomes "/usr/bin/perl" and "-w\r" is 
passed as
command line argument. However, Perl is nice and doesn't cause errors 
when handling the "-w\r" option.

Maybe there is a safer way to implement this. But the 'mod_ruid2.c' is 
not too forgiving.

<IfModule mod_ruid2.c>
      RMode config
      RUidGid testnet site1
</IfModule>

eg: '/etc/httpd/conf/vhosts/site1.includesite1.include' for example.

After this I could run perl in /web or /web/cgi-bin.
Haven't tried it wwwroot as of yet.

Hope this helps
David
On 9/28/2020 1:20 PM, David Hahn wrote:
> Hi all,
>
> Any tips on running a perl script on a 5210R? I get this error:
>
> 'The userid that the web server ran cgiwrap as does not match the 
> userid that was configured into the cgiwrap executable.
>
> This is a configuration/setup problem with cgiwrap on this server. 
> Please contact the server administrator.'
>
> I try nobody, apache, and owner. If I change web owner to nobody or 
> Apache I then can't access the directory through SFTP.
>
> Is there a package that I need to install?
>
-- 
Thank you
David Hahn
----




More information about the Blueonyx mailing list