The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Applications (http://hintsforums.macworld.com/forumdisplay.php?f=5)
-   -   netinfo question (http://hintsforums.macworld.com/showthread.php?t=19612)

ephelan 01-14-2004 12:25 PM

netinfo question
 
Prompted by today's mobile user hint I opened netinfo utility for the first time and noticed, among the various and sundry "users" two that are especially puzzling: name: "unknown", real name: "Unknown User" and name: "nobody", real name: "Unprivileged User". Would someone be good enough to explain what these are? Appreciate and thank.

jdera 01-14-2004 12:36 PM

Unix Heritage
 
Mac OS X has these accounts because services are often run using such an account for security reasons.

For example, let's take a look at the user "nobody."

Code:

$ finger nobody
Login: nobody                          Name: Unprivileged User
Directory: /var/empty                  Shell: /usr/bin/false
Never logged in.

You'll see here that the user's home directory is set to /var/empty, which does not exist. The user's shell is set to /usr/bin/false, which would prevent the user from logging into the system.

Now, the system uses the nobody user to run some processes. Here's an example on my system:

Code:

$ ps aux | grep nobody
nobody    193  0.0  0.1    28068    976  ??  Ss    9:28AM  0:01.50 /usr/sbin/mDNSResponder
nobody    600  0.0  0.2    66020  1584  ??  S    9:43AM  0:33.95 /Library/Xgrid/Agent/GridAgent

You'll see here that mDNSResponder is running as nobody. If for some reason the mDNSResponder daemon were compromised, the attacker would then have the effective permissions of the user that was running the process to start. This means that the attacker would now have the access of an account with no home directory and no shell, so there wouldn't be a whole lot the attacker could break.

ephelan 01-14-2004 12:48 PM

Thanks jdera. I wasn't always suspicious but there just seems to be a lot of unfriendly things happening lately. Tell the rest of your MA friends that today is not one for washing outdoor windows. e

drone540 08-06-2004 12:58 PM

Hey I have a question about the the /usr/bin/false for the user www

I'm trying to get .pl and .cgi files to be processed by perl. But I can't figure out why I never have permission to run the files. I've chmodded them and everything. The Chmod u-x or whatever it was was the closest thing for me that worked... But I'm still getting permissiono errors... Apache is running on user www, and I was wondering if its not able to access the shell for some reason to process perl.... The only perl stuff that actually works is awstats and I have no clue how that works unless it using root somehow.

drone540 08-11-2004 01:21 AM

Does anyone even know?

waked1 08-11-2004 03:15 AM

For perl scripts to run they need to be world executable, ie user RWX, group R-X and other R-X so you need chmod +x script.pl for it to work.

drone540 08-11-2004 11:43 PM

Quote:

Originally Posted by waked1
For perl scripts to run they need to be world executable, ie user RWX, group R-X and other R-X so you need chmod +x script.pl for it to work.

I've tried that chmod command.. That's the closest I've got to getting a .pl sript to run..... But I get this on everything except the awstats.pl file... Not even a copy of the file works because of this error.

[Wed Aug 11 23:41:34 2004] [error] [client 192.168.1.1] Premature end of script headers: /WebSTAR Server Suite 4.3/cgi-bin/test copy.pl

Even a Blank .pl file wont work.

waked1 08-12-2004 03:14 AM

Sorry, didn't realise you were using WebStar rather than Apache. Either way, I don't think it's a shell permissions issue getting an error like that, more likely a problem with the script itself.
Does the default script you copied have a reference to itself anywhere that would break if you change its name?
What happens when you run the script from the command line?
Code:

perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/test\ copy.pl

hayne 08-12-2004 10:16 AM

Quote:

Originally Posted by drone540
Even a Blank .pl file wont work.

A CGI script has certain responsibilities regarding what it returns to the server. An empty script certainly won't be fulfilling those responsibilities, hence the server error message. You need to read about the CGI specification and in particular about the requirement for the returned HTTP headers

drone540 08-12-2004 07:30 PM

Quote:

Originally Posted by waked1
Sorry, didn't realise you were using WebStar rather than Apache. Either way, I don't think it's a shell permissions issue getting an error like that, more likely a problem with the script itself.
Does the default script you copied have a reference to itself anywhere that would break if you change its name?
What happens when you run the script from the command line?
Code:

perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/test\ copy.pl

No I'm using Apache.. I just didn't move the files when I switched from OS 9 to OS X.

I've tried plenty of scripts.... None of them work with Apache.. But all of them work with perl via the terminal..... The only file that I have that actually executes is awstats.pl.... Also I've tried copying the source code from that file to another file which does not work. And they both have the same permissions. But I keep getting Error 500. Also when I load the page.. Perl doesn't even show up in the process list.

I can't figure this out. :confused:

waked1 08-13-2004 03:10 AM

In that case, have you changed your httpd.conf file to give execCGI on the webstar folder, or have you changed the scriptalias to point to it for cgi-bin?

drone540 08-13-2004 01:20 PM

Here check out my .conf file.

Click here to view my config file.

I'm, looking at someone else's conf file at the moment... They don't even use the CGI stuff in the their file and it runs somehow.... Maybe it has something to do with the Modules or something.. I'm still looking.. I'm looking up mod_headers... But I don't know if that has anything to do with cgi since their is only 1 file (from awstats installation) I can get to work.... I have no idea how that script works, yet I can't copy the code to another file without it not working... Anyways it has gotta be with this httpd.conf file.. I've tried just about everything apache said to do.

waked1 08-15-2004 04:54 AM

Your httpd.conf looks fine so I'm guessing it's a problem with the script itself.
How about trying a simple script like
Code:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";

to see if that works.

drone540 08-15-2004 12:28 PM

Code:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator,  email@mydomain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Apache/1.3.29 Server at localhost Port 80

That's with .cgi and .pl extentions.

The error logs says this... (don't mind the first 2.. i was looking at the man and it said +X but that didn't work so -X then +x it.)

Code:

[Sun Aug 15 12:17:40 2004] [error] [client 192.168.1.1] file permissions deny server execution: /WebSTAR Server Suite 4.3/cgi-bin/helloworld.pl
[Sun Aug 15 12:17:45 2004] [error] [client 192.168.1.1] file permissions deny server execution: /WebSTAR Server Suite 4.3/cgi-bin/helloworld.cgi
[Sun Aug 15 12:18:09 2004] [error] (2)No such file or directory: exec of /WebSTAR Server Suite 4.3/cgi-bin/helloworld.cgi failed
[Sun Aug 15 12:18:09 2004] [error] [client 192.168.1.1] Premature end of script headers: /WebSTAR Server Suite 4.3/cgi-bin/helloworld.cgi
[Sun Aug 15 12:18:11 2004] [error] (2)No such file or directory: exec of /WebSTAR Server Suite 4.3/cgi-bin/helloworld.cgi failed
[Sun Aug 15 12:18:11 2004] [error] [client 192.168.1.1] Premature end of script headers: /WebSTAR Server Suite 4.3/cgi-bin/helloworld.cgi


waked1 08-16-2004 03:13 AM

what does
Code:

which perl
give you?

drone540 08-19-2004 07:57 PM

Code:

jpowermac-g4s-Computer:/Users/powermac root# perl -v

This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2003, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

jpowermac-g4s-Computer:/Users/powermac root#

Code:

jpowermac-g4s-Computer:/Users/powermac root# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 1 RC3) configuration:
  Platform:
    osname=darwin, osvers=7.0, archname=darwin-thread-multi-2level
    uname='darwin hampsten 7.0 darwin kernel version 6.0: fri jul 25 16:58:41 pdt 2003; root:xnu-344.frankd.rootsxnu-344.frankd~objrelease_ppc power macintosh powerpc '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1495)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Locally applied patches:
        RC3
  Built under darwin
  Compiled at Sep 12 2003 19:50:49
  @INC:
    /System/Library/Perl/5.8.1/darwin-thread-multi-2level
    /System/Library/Perl/5.8.1
    /Library/Perl/5.8.1/darwin-thread-multi-2level
    /Library/Perl/5.8.1
    /Library/Perl
    /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.1
    /Network/Library/Perl
    .
jpowermac-g4s-Computer:/Users/powermac root#


drone540 08-22-2004 04:03 PM

Jeez still waiting for help on this one.

hayne 08-22-2004 05:28 PM

Looking back at the error log you posted, I see some "no such file or directory" errors. You need to check that those files actually exist under the path mentioned. I suspect they don't.

drone540 08-24-2004 12:48 AM

That's the thing though.... they are there...I would get a 404 error if they wasn't.

hayne 08-24-2004 01:34 AM

Please show us the content of the file helloworld.cgi

drone540 08-24-2004 03:53 PM

Here is the contents.

Code:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";


Also but this file doesn't even do anything in the terminal
Code:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/helloworld.cgi
[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/helloworld.pl
[jpowermac-g4s-Computer:~] powermac%

but lets say I try this perl_test.pl I get from the terminal

Code:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/perl_test.pl
Content-type: text/html


<html>
<head>
<title>Ikonboard Path and Environment Test</title>
<style>
BODY          {font: 10pt arial}
#red          {font: 10pt arial;color:red;font-weight:bold}
#bold        {font: 10pt arial;font-weight:bold}
#version      {font: 10pt arial;color:blue;font-weight:bold}
TABLE, TR, TD {font: 10pt arial;font-weight:bold}
#error        {font: 10pt arial;background:#EEEEEE;border:1px solid black; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; text-indent: 8pt}
#plain        {font: 10pt arial}
</style>
</head>
<body>
<center><h4>Ikonboard Path and Environment Test</h4></center>
<p>This script checks your paths and environment variables and prints the results based on its best information available.

<hr noshade>
<br><br><a id="bold">The absolute path to this script is: </a><a id="red">/Users/powermac</a>, on a <a id=red>Unknown</a> based platform.
<br><a id="bold">This server is running perl version: </a><a id="version">5.008001</a>.
<br><a id="bold">DOCUMENT_ROOT: </a><a id="red"></a>.
<br><a id="bold">CGI Version: </a><a id="version">2.98</a>
<br><br>

<table>
<tr><td>Has DB_File Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has CGI Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has DBI Perl module installed?</td><td>Yes</td></tr>
<tr><td>Has DBD-Mysql Perl module installed?</td><td>No</td></tr>
</table>

<br><div id="error"><b>Results:</b>
<br><br></div><br><br><b>Environment:</b>
<br><br>
<table>
<tr><td>$ENV{MACHTYPE}:</td><td id="plain">powerpc</td></tr>
<tr><td>$ENV{SHELL}:</td><td id="plain">/bin/bash</td></tr>
<tr><td>$ENV{OSTYPE}:</td><td id="plain">darwin</td></tr>
<tr><td>$ENV{SHLVL}:</td><td id="plain">1</td></tr>
<tr><td>$ENV{TERM_PROGRAM_VERSION}:</td><td id="plain">100</td></tr>
<tr><td>$ENV{VENDOR}:</td><td id="plain">apple</td></tr>
<tr><td>$ENV{PATH}:</td><td id="plain">/bin:/sbin:/usr/bin:/usr/sbin</td></tr>
<tr><td>$ENV{HOME}:</td><td id="plain">/Users/powermac</td></tr>
<tr><td>$ENV{USER}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{SECURITYSESSIONID}:</td><td id="plain">3b23260</td></tr>
<tr><td>$ENV{TERM_PROGRAM}:</td><td id="plain">Apple_Terminal</td></tr>
<tr><td>$ENV{__CF_USER_TEXT_ENCODING}:</td><td id="plain">0x1F5:0:0</td></tr>
<tr><td>$ENV{TERM}:</td><td id="plain">xterm-color</td></tr>
<tr><td>$ENV{HOSTTYPE}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{HOST}:</td><td id="plain">jpowermac-g4s-Computer.local</td></tr>
<tr><td>$ENV{GROUP}:</td><td id="plain">powermac</td></tr>
<tr><td>$ENV{PWD}:</td><td id="plain">/Users/powermac</td></tr>
<tr><td>$ENV{LOGNAME}:</td><td id="plain">powermac</td></tr>
</table><br>
<b>Include Path:
</b>
<br><ul><li>/System/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/System/Library/Perl/5.8.1</li>
<li>/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/Library/Perl/5.8.1</li>
<li>/Library/Perl</li>
<li>/Network/Library/Perl/5.8.1/darwin-thread-multi-2level</li>
<li>/Network/Library/Perl/5.8.1</li>
<li>/Network/Library/Perl</li>
<li>.</li>

<br><br><center><font size=1>Version 1.0a
<br>&copy; 2002 Luke Dawson for <a href=http://www.ikonboard.com>Ikonboard</a> and <a href=http://www.jarvisgroup.net>Jarvis Entertainment Group</a></font></center>
</body>
</html>
[jpowermac-g4s-Computer:~] powermac%

But when I run it thru webserver I get...

Code:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator,  myemail@hotmail.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Apache/1.3.29 Server at www.jpowermacg4.com Port 80

Error log shows:
Code:

[Tue Aug 24 15:50:22 2004] [error] (2)No such file or directory: exec of /WebSTAR Server Suite 4.3/cgi-bin/perl_test.pl failed
[Tue Aug 24 15:50:22 2004] [error] [client 192.168.1.1] Premature end of script headers: /WebSTAR Server Suite 4.3/cgi-bin/perl_test.pl

Access log shows:
Code:

192.168.1.1 - - [24/Aug/2004:15:50:22 -0400] "GET /cgi-bin/perl_test.pl HTTP/1.1" 500 619 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.4 (KHTML, like Gecko) Safari/125.9"

hayne 08-24-2004 05:20 PM

Quote:

Originally Posted by drone540
Here is the contents.

Code:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";

Also but this file doesn't even do anything in the terminal

Ah - I think I know what your problem is.
I think your script files have "Macintosh" line endings instead of "Unix" line endings. This can happen if you choose the wrong editor to create your scripts. Which text editor have you been using?

To fix things, open the file in an editor that is able to handle a variety of line-endings and re-save it with Unix line endings. One such editor is BBedit Lite. Another is SubEthaEdit.

If you open your current script files in 'pico' (in the Terminal, type: pico helloworld.cgi) you should see that the lines are screwed up.

honestpuck 08-24-2004 07:35 PM

Hi,

I've just had a quick read of this thread and my first thought was to wonder if the CGI handler in the web server is barfing at the spaces in the directory you are using. Does the awstats script you mention live in the same directory?

I'd recommend against having your CGI directory under your DocumentRoot, BTW. It's a major security concern.

Tony

honestpuck 08-24-2004 07:53 PM

OK, I've had a better look at your Apache config.

My suggestion would be to move your CGI files to /Library/WebServer/CGI-Executables and change the script alias back to the default of this directory.

Given your current setup this has three advantages.

1/ It gets rid of the suspect spaces in the path. Note that the awstats script that you say is working lives in a directory with no spaces in its path.

2/ It moves your CGI directory out from under your DocumentRoot

3/ It removes the possibility that the problem is the way you are script aliasing a directory back to itself. At the moment the real URL of your CGI directory is exactly the same as the one you are applying via the scriptalias command - making it a waste of time and perhaps a source of error inside Apache.

Oh, and while you are at it - have a serious think about moving your DocumentRoot to a path that doesn't have spaces. It is almost certain to cause you problems further down the track.

Tony

drone540 08-25-2004 12:24 AM

Awww just when I though you were onto something andt it was going to work.. still doesn't work

Code:

[Wed Aug 25 00:21:48 2004] [notice] Apache/1.3.29 (Darwin) PHP/4.3.2 mod_perl/1.26 configured -- resuming normal operations
[Wed Aug 25 00:21:48 2004] [notice] Accept mutex: flock (Default: flock)
[Wed Aug 25 00:21:52 2004] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/helloworld.cgi failed
[Wed Aug 25 00:21:52 2004] [error] [client 192.168.1.1] Premature end of script headers: /Library/WebServer/CGI-Executables/helloworld.cgi
[Wed Aug 25 00:21:53 2004] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/helloworld.cgi failed
[Wed Aug 25 00:21:53 2004] [error] [client 192.168.1.1] Premature end of script headers: /Library/WebServer/CGI-Executables/helloworld.cgi

Same thing for test.pl also....



and also.. awstats.pl works in my older directory (no aliases) with space.... but nothing else works.... not even copying that data into another file, or modifying the awstats file.

honestpuck 08-25-2004 01:04 AM

Hmmmm.

OK. Try fixing the line ends - that should improve things.

Then check where perl is installed :

ls -l /usr/bin/perl

should give you a result

-rwxr-xr-x 1 root wheel 19944 28 May 08:53 /usr/bin/perl

and just in case make sure that the line

<Directory "/Library/WebServer/CGI-Executables">

says exactly that with no trailing slash.

Also, to be totally on the safe side, turn off mod_perl by commenting out both the LoadModule and AddModule lines that mention it.

Then tell us what happened.

Tony

drone540 08-25-2004 01:12 PM

Code:

[jpowermac-g4s-Computer:~] powermac% ls -l /usr/bin/perl
-rwxr-xr-x  1 root  wheel  19944 15 Jul 00:24 /usr/bin/perl

Ok and turning off perl.. I still get 500 internal server errors.

I did not comment out the cgi-script .cgi .pl line since that doesn't use perl I don't think... and when I used the commented line below it.. perl-script .cgi .pl it just prints out the text of the file.... Not sure how ASP makes use of perl.

But yeah.. the problem has to do with something with cgi-script.

hayne 08-25-2004 03:01 PM

Please check the line-endings in your script files as I suggested a few posts back. The fact that your Perl script didn't work from the command-line strongly suggests that this is the problem.

drone540 08-26-2004 02:25 AM

it still doesn't work.. plus test.pl executes from terminal.. but it doesn't work in browser... still error 500..... jeez... It's never gonna work... it seems to choke on the cgi-script handler.... Also... With WebSTAR V.. I get errors with cgi files also (not sure which since no errors folder exists.. most likely 500 still.... and it has its own cgi plug-in. :( :confused: :eek: :mad:

drone540 08-31-2004 11:39 PM

Anyone know?


All times are GMT -5. The time now is 02:26 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.