This utility provides command line control of the
daemon. Its primary use is to facilitate
simple scripts that control a running daemon.
utility is passed at least one argument,
specifying the socket on which ppp
Refer to the ‘set server’ command of
for details. If the socket contains a leading
'/', it is taken as an
it contains a colon, it is treated as a
pair, otherwise it is treated as a TCP port specification on the local machine
(127.0.0.1). Both the host
may be specified numerically if you wish
to avoid a DNS lookup or do not have an entry for the given port in
All remaining arguments are concatenated to form the
(s) that will be sent to the
daemon. If any semi-colon characters are
found, they are treated as command
delimiters, allowing more than one command
a given ‘session’. For example:
pppctl 3000 set timeout 300\; show timeout
Do not forget to escape or quote the ';' as it is a special character for most
If no command
arguments are given,
enters interactive mode, where commands
are read from standard input. When reading commands, the
library is used, allowing
command-line editing (with editrc(5)
editing behaviour). The history size defaults to 20
The following command line options are available:
- Display all data sent to and received from the
ppp daemon. Normally,
pppctl displays only non-prompt lines
received. This option is ignored in interactive mode.
- Use a timeout of n instead
of the default 2 seconds when connecting. This may be required if you wish
to control a daemon over a slow (or even a dialup) link.
- Specify the password required by the
ppp daemon. If this switch is not used,
pppctl will prompt for a password once it has
successfully connected to ppp.
The following environment variables are understood by
when in interactive mode:
- The number of history lines. The default is 20.
- The edit mode. Only values of "emacs" and
"vi" are accepted. Other values are silently ignored. This
environment variable will override the bind
-v and bind -e commands in
If you run ppp
can be used to automate many frequent tasks (you can actually control
in any mode except interactive mode). Use of
option is discouraged (even in scripts
that are not readable by others) as a ps(1)
listing may reveal your secret.
The best way to allow easy, secure pppctl
to create a local server socket in
(in the correct section) like
set server /var/run/internet "" 0177
This will instruct ppp
to create a local domain
socket, with srw------- permissions and no password, allowing access only to
the user that invoked ppp
. Refer to the
man page for further details.
You can now create some easy-access scripts. To connect to the internet:
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 >/dev/null
if [ $? -eq 0 ]; then
echo Link is up
echo Link is down
You can even make a generic script:
exec pppctl /var/run/internet "$@"
You could also use pppctl
to control when
dial-on-demand works. Suppose you want ppp
all the time, but you want to prevent dial-out between 8pm and 8am each day.
However, any connections active at 8pm should continue to remain active until
they are closed or naturally time out.
entry for 8pm which runs
pppctl /var/run/internet set filter dial 0 deny 0 0
will block all further dial requests, and the corresponding 8am entry
pppctl /var/run/internet set filter dial -1
will allow them again.
utility first appeared in