[SLUG] PPP on Demand - User?

From: Larry Sanders (lsanders@flash.net)
Date: Mon Jan 07 2002 - 23:31:29 EST


Using the Linux PPP HOWTO, the firewall system, "gate"
will dial on demand to connect to the ISP.
The file /etc/ppp/ppp-on (see below) is executed by rc.local at boot.
Works great!! The options file is also included below.
I would like to have other users, mere mortals, to be able to stop
and start the deamon. I have created symbolic links in /bin ... BUT
when another user executes ppp-off, then follows this error:
    /bin/ppp-off: kill: (1590) - not owner
    rm: cannot unlink /var/run/ppp0.pid': Permission denied
    ERROR: Removed stale pid file
and the connection continues.
How do I let the deamon start at boot, but let any user stop/start it?

===================================================
#!/bin/sh
# File /etc/ppp/ppp-on
# Script to initiate a ppp connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
#
# These are the parameters. Change as needed.
TELEPHONE=555-1212 # The telephone number for the connection
ACCOUNT=username # The account name for logon (as in 'George Burns')
PASSWORD=userpass # The password for this account (and 'Gracie Allen')
LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0
REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0
NETMASK=255.255.255.0 # The proper netmask if needed
# Export them so that they will be available at 'ppp-on-dialer' time.
export TELEPHONE # ACCOUNT PASSWORD
#
# This is the location of the script which dials the phone and logs
# in. Please use the absolute file name as the $PATH variable is not
# used on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
#
# Initiate the connection
# I put most of the common options on this command. Please, don't
# forget the 'lock' option or some programs such as mgetty will not
# work. The asyncmap and escape will permit the PPP link to work with
# a telnet or rlogin connection. You are welcome to make any changes
# as desired. Don't use the 'defaultroute' option if you currently
# have a default route to an ethernet gateway.
# The file /etc/ppp/options is the default options list
# Now connect using modem on Serial 2 with some characters escaped and
# the chat dialer script:
#
exec /usr/sbin/pppd /dev/ttyS1 user $ACCOUNT connect $DIALER_SCRIPT \
 asyncmap 20A0000 escape FF netmask $NETMASK $LOCAL_IP:$REMOTE_IP
# debug kdebug 0 # extra logging can be commented out later
# End of ppp-on

=================================================
# options for pppd
# start with connect script file
# hardware opptions
 modem # use standard modem coltrol
 115200 # default/maximum speed to use
 crtscts # use hardware flow control
        lock # lock the serial port
        idle 275 # seconds idel to disconnect
# logfile pppd.log # append log msg to file
# authentication/connection options
        noauth # peer not required to authenticate
        noipdefault # get/use local ip from peer
        defaultroute # add default route to table
        usepeerdns # get/use dns addresses from peer
# demand dialing options
 demand # initiate link on demand
 persist # do not exit, try reconnect
 holdoff 3 # seconds to wait before re-link
#
# store as /etc/ppp/options
# check that /proc/sys/net/ipv4/ip_forward 1
# and that /proc/sys/net/ipv4/ip_dynaddr 1



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:24:06 EDT