badgerbox76
5th April 2008, 01:46
I fallowed falko's Howto guild (http://www.howtoforge.com/chrooted_ssh_howto_debian) and got Chroot working. Now I want to add/give more programs to chroot users
So I added a few programs to the script that was in the howto guild and ran it. Clear, nano to name a few
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
APPS="/bin/sh /bin/bash /bin/nano /bin/cp /bin/ls /bin/mkdir /bin/mv /bin/pwd /bin/rm /bin/rmdir /usr/bin/id /usr/bin/ssh /bin/ping /usr/bin/clear /usr/bin/dircolors /usr/bin/cmatrix /usr/bin/raggle /usr/bi$
for prog in $APPS; do
mkdir -p ./`dirname $prog` > /dev/null 2>&1
cp $prog ./$prog
# obtain a list of related libraries
ldd $prog > /dev/null
if [ "$?" = 0 ] ; then
LIBS=`ldd $prog | awk '{ print $3 }'`
for l in $LIBS; do
mkdir -p ./`dirname $l` > /dev/null 2>&1
cp $l ./$l > /dev/null 2>&1
done
fi
done
After running the script then having the chroot user get disconnected I reconnected to the server again to test things out.
login as: david
david@192.168.0.110's password:
Last login: Fri Apr 4 18:35:43 2008 from 192.168.0.104
david@atlbricks:~$ ls
david@atlbricks:~$ clear
'xterm': unknown terminal type.
david@atlbricks:~$ nano
Error opening terminal: xterm.
david@atlbricks:~$
Not working, I thought the script above grabbed all the necessary library files along with the program. I checked the chroot directory's and the programs are present.
So I added a few programs to the script that was in the howto guild and ran it. Clear, nano to name a few
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
APPS="/bin/sh /bin/bash /bin/nano /bin/cp /bin/ls /bin/mkdir /bin/mv /bin/pwd /bin/rm /bin/rmdir /usr/bin/id /usr/bin/ssh /bin/ping /usr/bin/clear /usr/bin/dircolors /usr/bin/cmatrix /usr/bin/raggle /usr/bi$
for prog in $APPS; do
mkdir -p ./`dirname $prog` > /dev/null 2>&1
cp $prog ./$prog
# obtain a list of related libraries
ldd $prog > /dev/null
if [ "$?" = 0 ] ; then
LIBS=`ldd $prog | awk '{ print $3 }'`
for l in $LIBS; do
mkdir -p ./`dirname $l` > /dev/null 2>&1
cp $l ./$l > /dev/null 2>&1
done
fi
done
After running the script then having the chroot user get disconnected I reconnected to the server again to test things out.
login as: david
david@192.168.0.110's password:
Last login: Fri Apr 4 18:35:43 2008 from 192.168.0.104
david@atlbricks:~$ ls
david@atlbricks:~$ clear
'xterm': unknown terminal type.
david@atlbricks:~$ nano
Error opening terminal: xterm.
david@atlbricks:~$
Not working, I thought the script above grabbed all the necessary library files along with the program. I checked the chroot directory's and the programs are present.