Followup-For: Bug #489653
Package: rssh
Tags: patch
Attached patch, although not that simple as changing the shell path on
the shebang line, should make the script work both with bash and dash.
These 2 lines:
echo_e="echo -e"
[ -z "$($echo_e)" ] || echo_e=echo
should do it.
Cheers,
--
Cristian
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE= (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages rssh depends on:
ii debconf [debconf-2.0] 1.5.22 Debian configuration management sy
ii libc6 2.7-12 GNU C Library: Shared libraries
ii openssh-server 1:4.7p1-12 secure shell server, an rshd repla
rssh recommends no packages.
-- debconf information excluded
--- /usr/share/doc/rssh/examples/mkchroot.sh 2008-07-13 22:10:10.000000000 +0200
+++ /tmp/mkchroot.sh 2008-07-14 21:08:25.000000000 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#####################################################################
#####################################################################
@@ -10,6 +10,9 @@
## fact, it may not work at all. Use at your own risk. :)
##
+echo_e="echo -e"
+[ -z "$($echo_e)" ] || echo_e=echo
+
fail() {
echo "`basename $0`: fatal error" >&2
@@ -69,7 +72,7 @@ if [ -n "$owner" -a `whoami` = "root" ];
exit 3
fi
else
- echo -e "NOT changing owner of root jail. \c"
+ $echo_e "NOT changing owner of root jail. \c"
if [ `whoami` != "root" ]; then
echo "You are not root."
else
@@ -85,7 +88,7 @@ if [ -n "$owner" -a `whoami` = "root" ];
exit 3
fi
else
- echo -e "NOT changing perms of root jail. \c"
+ $echo_e "NOT changing perms of root jail. \c"
if [ `whoami` != "root" ]; then
echo "You are not root."
else
@@ -153,7 +156,7 @@ for prog in $scp_path $sftp_server_path
for lib in $libs; do
mkdir -p "$jail_dir$(dirname $lib)" || \
fail "Error creating $(dirname $lib). Exiting" 6
- echo -e "\t$lib"
+ $echo_e "\t$lib"
cp "$lib" "$jail_dir$lib" || \
fail "Error copying $lib. Exiting" 6
done
@@ -175,9 +178,9 @@ cp /etc/passwd "$jail_dir/etc/" || \
fail "Error copying /etc/passwd. Exiting" 7
cp -r /etc/ld.* "$jail_dir/etc/" || \
fail "Error copying /etc/ld.*. Exiting" 7
-echo -e "\nWARNING: Copying /etc/passwd into the chroot jail. You may wish"
-echo -e "to edit out unnecessary users and remove any sensitive information"
-echo -e "from it."
+$echo_e "\nWARNING: Copying /etc/passwd into the chroot jail. You may wish"
+$echo_e "to edit out unnecessary users and remove any sensitive information"
+$echo_e "from it."
#####################################################################
#
@@ -191,19 +194,19 @@ if [ `whoami` = "root" ]; then
cp -a /dev/null "$jail_dir/dev" || \
fail "Error creating /dev/null. Exiting" 8
else
- echo -e "NOT creating /dev/null and /dev/log in the chroot jail. \c"
- echo -e "You are not root.\n"
+ $echo_e "NOT creating /dev/null and /dev/log in the chroot jail. \c"
+ $echo_e "You are not root.\n"
fi
-echo -e "Chroot jail configuration completed.\n"
+$echo_e "Chroot jail configuration completed.\n"
-echo -e "NOTE: if you are not using the passwd file for authentication,"
-echo -e "you may need to copy some of the /lib/libnss_* files into the jail.\n"
+$echo_e "NOTE: if you are not using the passwd file for authentication,"
+$echo_e "you may need to copy some of the /lib/libnss_* files into the jail.\n"
-echo -e "NOTE: you must MANUALLY edit your syslog rc script to start syslogd"
-echo -e "with appropriate options to log to $jail_dir/dev/log. In most cases,"
-echo -e "you will need to start syslog as:\n"
-echo -e " /sbin/syslogd -a $jail_dir/dev/log\n\n"
+$echo_e "NOTE: you must MANUALLY edit your syslog rc script to start syslogd"
+$echo_e "with appropriate options to log to $jail_dir/dev/log. In most cases,"
+$echo_e "you will need to start syslog as:\n"
+$echo_e " /sbin/syslogd -a $jail_dir/dev/log\n\n"
-echo -e "NOTE: we make no guarantee that ANY of this will work for you... \c"
-echo -e "if it\ndoesn't, you're on your own. Sorry!\n"
+$echo_e "NOTE: we make no guarantee that ANY of this will work for you... \c"
+$echo_e "if it\ndoesn't, you're on your own. Sorry!\n"