Command line interface Example scripts
Digi CM User Guide 151
4 Reboot
reboot
Note If you factory default the unit, the '/usr2/rc.user' script file is moved to '/usr2/rc.user.old#'
and the default rc.user file will be restored.
Example script: Limiting root access to the console on Digi CM products (for SSH only)
This prevents root access from any means except physically logging in on the Digi CM console.
1 Modify '/etc/inetd.conf' and append -f /usr2/sshd_config to the sshd line.
cp /etc/inetd.conf /usr2/inetd.conf
2 Edit '/etc/ssh/sshd_config'. Change "PermitRootLogin" to no.
cp /etc/ssh/sshd_config /usr2
3 Add the following commands in the '/usr2/rc.user' script. Add these commands just above "exit
0":
cp -a /usr2/inetd.conf /etc/inetd.conf
while killall inetd 2>/dev/null;
do sleep 5;
done
/usr/sbin/inetd
4 Reboot
reboot
Note If you factory default the unit, the '/usr2/rc.user' script file is moved to '/usr2/rc.user.old#'
and the default rc.user file will be restored.
Example script: Sending a break from an existing session with the Digi CM unit from a Telnet session
If the Telnet was initiated from a UNIX command line Telnet client. Issuing the Telnet escape
sequence '^]' (control-right_square_bracket) will take you to the 'telnet>' prompt.
telnet>send brk
Note Other Telnet clients often have a "send break" option.
From an ssh session Type the [tilde-break] which is the default ssh break characters.
~break
The ssh break can changed from the Web UI or config menu under Serial ports > Configuration >
Host mode configuration > SSH break sequence
Additional binaries or applications can be added to /usr2 such as:
▪ crontab
▪ netstat
▪ fuser
To download these utilities go to: https://www.digi.com/products/consoleservers/
digicm#productsupport