Firmware post V2.2.1 supports scriptable console login banners. If a file called /etc/config/pmshell-start.sh exists it is run when a user connects to a port. It is provided two arguments, the "Port number" and the "Username". Here is a simple example:
echo "Welcome to port $PORT $USER"
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:
LABEL=$(config -g config.ports.port$PORT.label | cut -f2- -d' ')
if [ "$USER" == "root" ]; then
echo "Permission denied for Super User"
if [ -z "$LABEL" ]; then
echo "Welcome $USER, you are connected to Port $PORT"
echo "Welcome $USER, you are connected to Port $PORT ($LABEL)"
Please note this only works for admin users, other users will not be able to access the serial ports.
To automatically send a carriage return to each serial port. Reference the following snippet in your pmshell-start.sh script for each console server to be enabled.
echo > $(printf /dev/port%02d $1)