1997-11-07 20:20:15 +00:00
|
|
|
.\" $Id: pppctl.8,v 1.5 1997/11/07 02:54:46 brian Exp $
|
1997-06-28 01:04:54 +00:00
|
|
|
.Dd 26 June 1997
|
|
|
|
.Os FreeBSD
|
|
|
|
.Dt PPPCTL 8
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pppctl
|
|
|
|
.Nd
|
|
|
|
PPP control program
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl v
|
|
|
|
.Op Fl t Ar n
|
|
|
|
.Op Fl p Ar passwd
|
1997-07-28 22:17:48 +00:00
|
|
|
.Ar [host:]Port | LocalSocket
|
1997-11-07 02:54:49 +00:00
|
|
|
.Op command[;command]...
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
This program provides command line control of the
|
1997-11-07 02:54:49 +00:00
|
|
|
.Xr ppp 8
|
1997-06-28 01:04:54 +00:00
|
|
|
daemon. Its primary use is to facilitate simple scripts that
|
|
|
|
control a running daemon.
|
|
|
|
|
|
|
|
.Nm Pppctl
|
1997-11-07 02:54:49 +00:00
|
|
|
is passed at least one argument, specifying the socket on which
|
1997-06-28 01:04:54 +00:00
|
|
|
.Nm ppp
|
1997-11-07 02:54:49 +00:00
|
|
|
is listening. Refer to the
|
|
|
|
.Sq set server
|
|
|
|
command of
|
|
|
|
.Nm ppp
|
|
|
|
for details. If the socket contains a leading '/', it
|
|
|
|
is taken as an
|
|
|
|
.Dv AF_LOCAL
|
|
|
|
socket. If it contains a colon, it is treated as a
|
|
|
|
.Ar host:port
|
|
|
|
pair, otherwise it is treated as a TCP port specification on the
|
|
|
|
local machine (127.0.0.1). Both the
|
|
|
|
.Ar host
|
|
|
|
and
|
|
|
|
.Ar port
|
|
|
|
may be specified numerically if you wish to avoid a DNS lookup
|
|
|
|
or don't have an entry for the given port in
|
1997-06-28 01:04:54 +00:00
|
|
|
.Pa /etc/services .
|
1997-07-28 22:17:48 +00:00
|
|
|
|
|
|
|
.Pp
|
1997-11-07 02:54:49 +00:00
|
|
|
All remaining arguments are concatenated to form the
|
|
|
|
.Ar command(s)
|
|
|
|
that will be sent to the
|
1997-06-28 01:04:54 +00:00
|
|
|
.Nm ppp
|
1997-11-07 02:54:49 +00:00
|
|
|
daemon. If any semi-colon characters are found, they are treated as
|
|
|
|
.Ar command
|
|
|
|
delimiters, allowing more than one
|
|
|
|
.Ar command
|
|
|
|
in a given "session". For example:
|
1997-06-28 01:04:54 +00:00
|
|
|
|
|
|
|
pppctl 3000 set timeout 300\\; show timeout
|
|
|
|
|
|
|
|
Don't forget to escape or quote the ';' as it is a special character
|
|
|
|
for most shells.
|
|
|
|
|
1997-11-07 02:54:49 +00:00
|
|
|
If no
|
|
|
|
.Ar command
|
|
|
|
arguments are given,
|
|
|
|
.Nm
|
|
|
|
enters interactive mode, where commands are read from standard input.
|
1997-11-07 20:20:15 +00:00
|
|
|
When reading commands, the
|
|
|
|
.Xr editline 3
|
|
|
|
library is used, allowing command-line editing (with
|
|
|
|
.Xr editrc 5
|
|
|
|
defining editing behaviour). The history size
|
|
|
|
defaults to
|
|
|
|
.Em 20 lines .
|
1997-11-07 02:54:49 +00:00
|
|
|
|
1997-06-28 01:04:54 +00:00
|
|
|
The following command line options are available:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl v
|
|
|
|
Display all data sent to and received from the
|
|
|
|
.Nm ppp
|
|
|
|
daemon. Normally,
|
|
|
|
.Nm pppctl
|
1997-11-07 20:20:15 +00:00
|
|
|
displays only non-prompt lines received. This option is ignored in
|
|
|
|
interactive mode.
|
1997-06-28 01:04:54 +00:00
|
|
|
.It Fl t Ar n
|
|
|
|
Use a timeout of
|
|
|
|
.Ar n
|
|
|
|
instead of the default 2 seconds. This may be required if you
|
|
|
|
wish to control a daemon over a slow (or even a dialup) link.
|
|
|
|
.It Fl p Ar passwd
|
|
|
|
Specify the password required by the
|
|
|
|
.Nm ppp
|
|
|
|
daemon. If this switch is not used,
|
|
|
|
.Nm
|
|
|
|
will prompt for a password once it has successfully connected to
|
1997-10-05 14:21:30 +00:00
|
|
|
.Nm ppp .
|
1997-06-28 01:04:54 +00:00
|
|
|
.El
|
|
|
|
|
1997-10-05 14:21:30 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
Assuming you want to run
|
|
|
|
.Nm ppp
|
|
|
|
in
|
|
|
|
.Fl auto
|
|
|
|
mode,
|
|
|
|
.Nm
|
|
|
|
can be used to automate many frequent tasks. Use of the
|
|
|
|
.Fl p
|
|
|
|
option is discouraged (even in scripts that aren't readably by others)
|
|
|
|
as a
|
|
|
|
.Xr ps 1
|
|
|
|
listing may reveal your secret.
|
|
|
|
.Pp
|
|
|
|
In order to have
|
|
|
|
.Nm ppp
|
|
|
|
create a socket for use with
|
|
|
|
.Nm pppctl ,
|
|
|
|
you will need to define a password for your local system:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
# touch /etc/ppp/ppp.secret
|
|
|
|
# chown root.wheel /etc/ppp/ppp.secret
|
|
|
|
# chmod 400 /etc/ppp/ppp.secret
|
|
|
|
# echo "`hostname -s` MyPassword" >>/etc/ppp/ppp.secret
|
|
|
|
.Ed
|
|
|
|
|
|
|
|
.Pp
|
|
|
|
The most secure way to allow easy, secure
|
|
|
|
.Nm
|
|
|
|
access, and to make sure you can distinguish between multiple invocations
|
|
|
|
of
|
|
|
|
.Nm ppp
|
|
|
|
is to create a local server socket in
|
|
|
|
.Pa /etc/ppp/ppp.conf
|
|
|
|
(in the correct section):
|
|
|
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
set server /var/run/internet 0666
|
|
|
|
.Ed
|
|
|
|
|
|
|
|
This will instruct
|
|
|
|
.Nm ppp
|
|
|
|
to create a local domain socket rather than the tcp socket that's created
|
|
|
|
by default. Refer to the
|
|
|
|
.Xr ppp 8
|
|
|
|
man page for further details.
|
|
|
|
|
|
|
|
.Pp
|
|
|
|
You can now create some easy-access scripts. To connect to the internet:
|
|
|
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
test $# -eq 0 && time=300 || time=$1
|
|
|
|
exec pppctl -t 60 /var/run/internet set timeout $time\\; dial
|
|
|
|
.Ed
|
|
|
|
|
|
|
|
.Pp
|
|
|
|
To disconnect:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
exec pppctl /var/run/internet set timeout 300\\; close
|
|
|
|
.Ed
|
|
|
|
|
|
|
|
.Pp
|
|
|
|
To check if the line is up:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
pppctl -p '' -v /var/run/internet '' | grep ^PPP >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo Link is up
|
|
|
|
else
|
|
|
|
echo Link is down
|
|
|
|
fi
|
|
|
|
.Ed
|
|
|
|
|
|
|
|
.Pp
|
|
|
|
You can even make a generic script:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
exec pppctl /var/run/internet "$@"
|
|
|
|
.Ed
|
|
|
|
|
1997-11-07 20:20:15 +00:00
|
|
|
.Sh ENVIRONMENT VARIABLES
|
|
|
|
The following environment variables are understood by
|
|
|
|
.Nm pppctl
|
|
|
|
when in interactive mode:
|
|
|
|
.Bl -tag -width XXXXXXXXXX
|
|
|
|
.It Dv EL_SIZE
|
|
|
|
The number of history lines. The default is 20.
|
|
|
|
.It Dv EL_EDITOR
|
|
|
|
The edit mode. Only values of "emacs" and "vi" are accepted. Other values
|
|
|
|
are silently ignored. This environment variable will override the
|
|
|
|
.Ar bind -v
|
|
|
|
and
|
|
|
|
.Ar bind -e
|
|
|
|
commands in
|
|
|
|
.Pa ~/.editrc .
|
|
|
|
.El
|
|
|
|
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh SEE ALSO
|
1997-11-07 20:20:15 +00:00
|
|
|
.Xr editline 3 ,
|
|
|
|
.Xr editrc 5 ,
|
|
|
|
.Xr ppp 8 ,
|
|
|
|
.Xr services 5
|
1997-06-28 01:04:54 +00:00
|
|
|
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command first appeared in FreeBSD 2.2.5.
|