Starting pppd from a CGI-Script

Starting pppd from a CGI-Script

Post by Daniel A. Taube » Thu, 25 Dec 1997 04:00:00



I'm building a CGI interface to PPP and am having trouble getting pppd to run from a script.

I have my CGI script execute /etc/ppp/ppp-on, which is set as owned by root and has the sticky bit set. Running this form the command line, even when I'm not logged in as root, starts up PPP.

Looking at stderr, I see the following error message:

/dev/null/.ppprc: Not a directory

I've tried setting HOME to /tmp before executing pppd without any luck. Does anyone know of a way to stop pppd from looking for this init file or to specify what directory it should look in?

Thanks,

Dan Tauber
http://www.dnai.com/~vox

 
 
 

Starting pppd from a CGI-Script

Post by Greml » Mon, 29 Dec 1997 04:00:00




Quote:>I'm building a CGI interface to PPP and am having trouble getting pppd to run from a script.
>I have my CGI script execute /etc/ppp/ppp-on, which is set as owned by root and has the sticky bit set. Running this form the command line, even when I'm not logged in as root, starts up PPP.
>Looking at stderr, I see the following error message:
>/dev/null/.ppprc: Not a directory
>I've tried setting HOME to /tmp before executing pppd without any luck. Does anyone know of a way to stop pppd from looking for this init file or to specify what directory it should look in?
>Thanks,
>Dan Tauber

This is how I start pppd:

#!/bin/bash
/bin/setserial /dev/modem spd_vhi
sleep 1
cd /usr/sbin
if [ -f /var/lock/LCK..modem ] ; then
    echo "Can NOT start pppd - the modem seems to be busy"
    echo "System will erase lock file"
    rm /var/lock/LCK..modem
    exit 8
else
pppd connect "chat -v -f /bin2/dial-gti" -detach /dev/modem 115200
crtscts &
fi
exit 0
# end of script

Once pppd is running:
the script /etc/ppp/ip-up is started

** note this is not for a cgi-script
** This is called from rc.local
** It may be a model to help you

 
 
 

Starting pppd from a CGI-Script

Post by o.. » Thu, 01 Jan 1998 04:00:00



|>
|> >I'm building a CGI interface to PPP and am having trouble getting pppd to run from a script.
|> >I have my CGI script execute /etc/ppp/ppp-on, which is set as owned by root and has the sticky bit set. Running this form the command line, even when I'm not logged in as root, starts up PPP.
|> >Looking at stderr, I see the following error message:
|> >/dev/null/.ppprc: Not a directory
|> >I've tried setting HOME to /tmp before executing pppd without any luck. Does anyone know of a way to stop pppd from looking for this init file or to specify what directory it should look in?

A cgi-script runs as user nobody and that causes problems for ppp accessing .ppprc.
You could wrap your cgi-script with a small C-program that does
setuid to a user that is suitable for running ppp.

Olav

 
 
 

Starting pppd from a CGI-Script

Post by Ahmed Masu » Wed, 07 Jan 1998 04:00:00



> I'm building a CGI interface to PPP and am having trouble getting pppd to run from a script.

> I have my CGI script execute /etc/ppp/ppp-on, which is set as owned by root and has the sticky bit set. Running this form the command line, even when I'm not logged in as root, starts up PPP.

> Looking at stderr, I see the following error message:

> /dev/null/.ppprc: Not a directory

In the script that launches /etc/ppp/ppp have an entry like:export HOME=/etc/ppp

The ppp program looks at the HOME environment variable (which for httpd user in your password file is /dev/null).  So it cannot find it.
The second technique is to launch pppd as ...

    /sbin/pppd file <rcfile> <other-options>

Quote:

> I've tried setting HOME to /tmp before executing pppd without any luck. Does anyone know of a way to stop pppd from looking for this init file or to specify what directory it should look in?

> Thanks,

> Dan Tauber
> http://www.dnai.com/~vox