Operating System - HP-UX
1752577 Members
5027 Online
108788 Solutions
New Discussion юеВ

Re: creating ls in a chrooted environment

 
SOLVED
Go to solution
Chris Harris
Contributor

creating ls in a chrooted environment

i'm trying to get a 'dir' command to work for ftp users that are chrooted. i have copied the ls command to the ~/bin directory, and copied the shared libraries to the ~/usr/lib directory. (special thanks to j ferguson and others who provided me with the chatdr command)

there were two shared files indicated by chatr, libc.2 and libcurses.1. it's still not working, however by issuing an ls -lu i can tell that everything is being accessed with the exception of the libcurses.1

here's the permissions:

~/lib
-r-xr-xr-x 1 root sys 1462272 Nov 28 16:30 libc.2
-r-xr-xr-x 1 root sys 196608 Nov 28 16:29 libcurses.1
-r-xr-xr-x 1 root sys 126976 Nov 27 19:08 dld.sl

any ideas on what is going wrong?
3 REPLIES 3
Christopher Caldwell
Honored Contributor
Solution

Re: creating ls in a chrooted environment

Use /sbin/ls

s[tatic]bin/ls - no libraries need.

cp /sbin/ls to chroot_dir/bin
Christopher Caldwell
Honored Contributor

Re: creating ls in a chrooted environment

BTW,

The dyna-linked version of ls is looking for the libraries in /usr/lib

$chatr /usr/bin/ls

dynamic /usr/lib/libcurses.1
dynamic /usr/lib/libc.2


From a security standpoint, minimize what goes in the chroot area - use /sbin/ls instead.
Kevin Wright
Honored Contributor

Re: creating ls in a chrooted environment

As I told you on your previous email, use the static ls../sbin/ls.

However your chroot'd environment is not correct if you have ~/lib..it needs to be ~/usr/lib.