Example scripts – Digi CM User Manual

Page 120

Advertising
background image

Example Scripts

120

Chapter 15

User Storage Space

The Digi CM comes with 1 megabyte of user storage space. This storage
space can be used to store custom scripts. The location is /usr2. Custom
scripts such as simple commands, are simply dropped into /usr2. If a file
needs to be edited, copy the file into usr2/rc.usr, kill the process, then restart
the process from the new file. Scripts from the user storage may be created to
run during boot after the network is up. The following are some examples of
various ways to create a script stored in the user storage space.

Saving IP tables options permanently

Changing radius socket ports

Limiting root access to the console on Digi CM products

Sending a break

Example Scripts

Example Script: Saving IP tables options permanently

Add the following command in the '/usr2/rc.user' script file just above "exit
0". Disabling Telnet is just shown as one example.

1. Create a new script file '/usr2/run.user' which includes the commands you

want.

iptables -A INPUT -p tcp --dport 23 -j DROP

2. Run the following command to make the script executable

chmod 755 /usr2/run.user

3. Add the following command in the '/usr2/rc.user' script, just above "exit 0"

ln -s /usr2/run.user /etc/rc.d/rc2.d/S60runuser

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: Changing radius socket ports

The radius client obtains the radius socket ports to use via the
'/etc/services' file. The client only looks up the lines starting with 'radius'
and 'radacct'.

snmpd.conf

SNMP information

./.ssh

Directory for SSH information

system.cnf

Basic network config information (IP, gateway, etc)

timezone

Time zone configuration

./.usracctl

Directory containing user access control information

version

Firmware version

File Name

Description

Advertising