_____________________________________________________________________
724-746-5500 | blackbox.com
Page 249
-
The return value from the script controls whether the user is accepted or not, if 0 is returned (or nothing is done on
exit as in the above script) the user is permitted, otherwise the user is denied access.
-
Here is a more complex script which reads from configuration to display the port label if available and denies access
to the root user:
</etc/config/pmshell-‐start.sh>
#!/bin/sh
PORT="$1"
USER="$2"
LABEL=$(config -‐g config.ports.port$PORT.label | cut -‐f2-‐ -‐d' ')
if [ "$USER" == "root" ]; then
echo "Permission denied for Super User"
exit 1
fi
if [ -‐z "$LABEL" ]; then
echo "Welcome $USER, you are connected to Port $PORT"
else
echo "Welcome $USER, you are connected to Port $PORT ($LABEL)"
fi
</etc/config/pmshell-‐start.sh>
15.3 Raw access to Serial Ports
15.3.1 Access to serial ports
You can use
tip
and
stty
to completely bypass the
portmanager
and have raw access to the serial ports.
When you run
tip
on a
portmanager
controlled port,
portmanager
closes that port, and stops monitoring it until
tip
releases control of it.
With
stty
, the changes made to the port only “stick” until that port is closed and opened again. People probably will not
want to use
stty
for more than initial debugging of the serial connection.
If you want to use
stty
to configure the port, you can put
stty
commands in
/etc/config/scripts/portXX.init
which gets run
whenever portmanager opens the port.
Otherwise, any setup you do with
stty
will get lost when the portmanager opens the port. (The reason that portmanager
sets things back to its
config
rather than using whatever is on the port, is so the port is in a known good state, and will
work, no matter what things are done to the serial port outside of portmanager.)
15.3.2 Accessing the console/modem port
The console dial-‐in is handled by
mgetty
, with automatic PPP login extensions.
mgetty
is a smart
getty
replacement,
designed to be used with Hayes compatible data and data/fax modems.
mgetty
knows about modem initialization,
manual modem answering (your modem doesn’t answer if the machine isn’t ready), UUCP locking (you can use the
same device for dial-‐in and dial-‐out).
mgetty
provides very extensive logging facilities. All standard
mgetty
options are
supported.
Modem initialization strings:
-
To override the standard modem initialization string either use the Management Console (refer
Chapter 5
) or the
command line config tool (refer to
Dial-‐In Configuration Chapter 14
).
Enabling Boot Messages on the Console: