HP-UX Compartment Login Using Secure Shell (SSH)
13
Appendix C – Sample /sbin/init.d/secsh.cmpt RC script
This sample RC script helps to start and stop an instance of sshd running in compartment cmpt1 and
cmpt2 using the compartment specific sshd configuration file.
#!/sbin/sh
#
#
# List of compartments where sshd needs to be started. Also configure
# the sshd configuration file for every compartment.
# Set the MAX_INDEX as per the array size.
MAX_INDEX=2
SSHD_CMPT[1]="cmpt1"
SSHD_CMPT[2]="cmpt2"
SSHD_CONF[1]="/opt/ssh/etc/sshd_config_cmpt1"
SSHD_CONF[2]="/opt/ssh/etc/sshd_config_cmpt2"
#
#
# sshd.rc: SSH daemon start-up and shutdown script
#
# Allowed exit values:
# 0 = success; causes "OK" to show up in checklist.
# 1 = failure; causes "FAIL" to show up in checklist.
# 2 = skip; causes "N/A" to show up in the checklist.
# Use this value if execution of this script is overridden
# by the use of a control variable, or if this script is not
# appropriate to execute for some other reason.
# 3 = reboot; causes the system to be rebooted after execution.
# Input and output:
# stdin is redirected from /dev/null
#
# stdout and stderr are redirected to the /etc/rc.log file
# during checklist mode, or to the console in raw mode.
# Configure the list of compartment where sshd needs to be started.
PRIVRUN=/usr/bin/privrun
PATH=/usr/sbin:/usr/bin:/sbin:
export PATH
WHAT='HP-UX Secure Shell'
WHAT_PATH=/opt/ssh/sbin/sshd
WHAT_PID=/var/run/sshd.pid
WHAT_CONFIG=/etc/rc.config.d/sshd
# NOTE: If your script executes in run state 0 or state 1,
# then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater.
# Other
# file systems typically not mounted until run state 2 include /var
# and /opt.
rval=0
# Check the exit value of a command run by this script. If non-zero, the
# exit code is echoed to the log file and the return value of this script
# is set to indicate failure.










