Installing opensshd on Sun Cobalt Linux, shell interpreter issue
David Levy
David.Levy at Sun.COM
Wed Jan 4 19:58:13 EST 2006
I have just installed openssh on my Sun Cobalt Qube, running Linux.
The shell interpreter for the rc script forces /sbin/sh. This is defined
in opensshd.init.in. This shell does not exist on this implementation of
Linux. I have written about this in (much more) detail at
http://blogs.sun.com/roller/page/DaveLevy/20060104. NB This would seem
to me to be a common problem but I havn't found any references in the
archives.
The following bourne shell code would test for the requirement for a fix.
if [ ! -x /sbin/sh ] && [ -x /bin/sh ]
then
# Change the shell interpreter
# .......
fi
I suggest that
if [ ! -x /sbin/sh ]&& [ -x /bin/sh ]
then
# Change the shell interpreter
script_ver=4_bin_sh
cat ${opensshd_script_name} | sed -e "s?\#\!/sbin/sh?\#\!/bin/sh?g" \
>> ${opensshd_script_name}.${script_ver}
fi
would be one way of doing it.
This would yield a file called opensshd.init.in.4_bin_sh. The "if shell
exists" test would need to be repeated in the install script to ensure
that the correct script was copied from the install directory to
/etc/rc.d/init.d directory.
The blog article http://blogs.sun.com/roller/page/DaveLevy/20060104 also
discusses Linux's chkconfig. This would be simple to implement and on
systems where it exists, make the install task simpler. (Is this an
enhancement request?) This suggests that one script file for non
chkconfig aware implementations and one for those that have it, although
the opensshd.init.in only requires comment lines added. The install
script would need to check for the existence of chkconfig and an
implementation name scheme would need to be developed.
NB I am considering writing a "status" branch for opensshd.init, let me
know if anyone's interested. (I shall probably only browse the process
table and test it on my Qube's Linux).
--
Dave
<http://www.sun.com> * David Levy *
*Sun Microsystems Ltd.*
55, King William St.,
London EC4R 9ND United Kingdom
Phone +44 (0) 20 7469 9908/x18308
Mobile +44 (0) 7710-360922
Blog http://blogs.sun.com/DaveLevy
Email David.Levy at Sun.COM
Sun Proprietary & Confidential . This e-mail message is for the sole use
of the intended recipient(s) and may contain confidential and
privilidged information. Any unauthorised review, use, disclosure or
distribution is prohibited. If you are not the intended recepient,
please contact the sender by reply e-mail and destroy all copies of the
original message.
More information about the openssh-unix-dev
mailing list