pppctl - PPP control program
pppctl [-v] [-p passwd] [-t n] [host:]port | LocalSocket
[command [;command ...]]
This program provides command line control of the ppp(8)
primary use is to facilitate simple scripts that control a
pppctl is passed at least one argument, specifying the socket on which
ppp(8) is listening. Refer to the set server command of
ppp(8) for details.
If the socket contains a leading `/', it is taken as
socket. If it contains a colon, it is treated as a
host:port pair, otherwise
it is treated as a TCP port specification on the local machine
(127.0.0.1). Both the host and port may be specified numerically if you
wish to avoid a DNS lookup or don't have an entry for the
given port in
All remaining arguments are concatenated to form the command(s) that will
be sent to the ppp(8) daemon. If any semi-colon characters
they are treated as command delimiters, allowing more than
one command in
a given ``session''. For example (adding a route):
pppctl 3000 add 192.168.1.0 255.255.255.0 127.0.0.1;
Don't forget to escape or quote the `;' as it is a special
If no command arguments are given, pppctl enters interactive
commands are read from standard input. When reading commands, the
editline(3) library is used, allowing command-line editing
editrc(5) defining editing behaviour). The history size defaults to 20
The following command line options are available:
-p passwd Specify the password required by the ppp(8)
daemon. If this
switch is not used, pppctl will prompt for a
it has successfully connected to ppp(8).
-t n Use a timeout of n instead of the default 2
connecting. This may be required if you wish
to control a
daemon over a slow (or even a dialup) link.
-v Display all data sent to and received from the
Normally, pppctl displays only non-prompt
This option is ignored in interactive
The following environment variables are understood by pppctl
when in interactive
EL_SIZE The number of history lines. The default is 20.
EL_EDITOR The edit mode. Only values of ``emacs'' and
``vi'' are accepted.
Other values are silently ignored.
variable will override the ``bind -v'' and
``bind -e'' commands
If you run ppp(8) in -auto mode, pppctl can be used to automate many frequent
tasks (you can actually control ppp(8) in any mode except interactive
mode). Use of the -p option is discouraged (even in
aren't readable by others) as a ps(1) listing may reveal
The best way to allow easy, secure pppctl access is to create a local
server socket in /etc/ppp/ppp.conf (in the correct section)
set server /var/run/internet "" 0177
This will instruct ppp to create a local domain socket, with
permissions and no password, allowing access only to the user that invoked
ppp. Refer to the ppp(8) man page for further details.
You can now create some easy-access scripts. To connect to
test $# -eq 0 && time=300 || time=$1
exec pppctl /var/run/internet set timeout $time; dial
exec pppctl /var/run/internet set timeout 300; close
To check if the line is up:
pppctl -p '' -v /var/run/internet quit | grep ^PPP
if [ $? -eq 0 ]; then
echo Link is up
echo Link is down
You can even make a generic script:
exec pppctl /var/run/internet "$@"
ps(1), editline(3), editrc(5), services(5), ppp(8)
The pppctl command first appeared in FreeBSD 2.2.5.
OpenBSD 3.6 June 26, 1997
[ Back ]