I fallowed falko's Howto guild 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 Code: #!/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. Code: login as: david [email protected]'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.
http://bbs.archlinux.org/viewtopic.php?pid=276800 It seems you also need ncurses and/or /usr/share/terminfo in the chroot jail.
Yes /usr/share/terminfo so I copied it over to /home/chroot/usr/share/terminfo and re-ran the script Whats wrong with the script? Am I doing something wrong here? Code: systemadmin@atlbricks:/$ sudo /usr/local/sbin/create_chroot_env cp: `/bin/sh' and `.//bin/sh' are the same file cp: `/bin/bash' and `.//bin/bash' are the same file cp: `/bin/nano' and `.//bin/nano' are the same file cp: `/bin/cp' and `.//bin/cp' are the same file cp: `/bin/ls' and `.//bin/ls' are the same file cp: `/bin/mkdir' and `.//bin/mkdir' are the same file cp: `/bin/mv' and `.//bin/mv' are the same file cp: `/bin/pwd' and `.//bin/pwd' are the same file cp: `/bin/rm' and `.//bin/rm' are the same file cp: `/bin/rmdir' and `.//bin/rmdir' are the same file cp: `/usr/bin/id' and `.//usr/bin/id' are the same file cp: `/usr/bin/ssh' and `.//usr/bin/ssh' are the same file cp: `/bin/ping' and `.//bin/ping' are the same file cp: `/usr/bin/clear' and `.//usr/bin/clear' are the same file cp: `/usr/bin/dircolors' and `.//usr/bin/dircolors' are the same file cp: `/usr/bin/cmatrix' and `.//usr/bin/cmatrix' are the same file cp: `/usr/bin/raggle' and `.//usr/bin/raggle' are the same file cp: `/usr/bin/vi' and `.//usr/bin/vi' are the same file cp: `/usr/bin/sftp' and `.//usr/bin/sftp' are the same file cp: `/usr/lib/openssh/sftp-server' and `.//usr/lib/openssh/sftp-server' are the same file systemadmin@atlbricks:/$ I don't know why I need this file but because all my terminal programs run fine under a regular user login I am just having a hard time getting them to work under chroot users. Code: systemadmin@atlbricks:/$ sudo apt-get install ncurses Reading package lists... Done Building dependency tree... Done Package ncurses is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package ncurses has no installation candidate systemadmin@atlbricks:/$ Still no working, um
Code: systemadmin@atlbricks:~$ sudo apt-get install ncurses-base Reading package lists... Done Building dependency tree... Done ncurses-base is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded. systemadmin@atlbricks:~$
The next step is to try to get ncurses-base into the chroot jail. Here's the list of files that belong to that package: http://packages.debian.org/etch/all/ncurses-base/filelist