>We would like to be able to run ftpd in a chrooted environment, but initial
>attempts have not succeeded.
>
>Is anyone running ftpd in a chrooted environment, and if so:
>
>Did you have to modify the daemon ?
>If so what mods did you make ?
You could write a program like:
#define FTPDIR "/usr/spool/ftp"
#define FTPEXEC "/bin/ftpd"
main()
{
if(chdir(FTPDIR)) {
perror(FTPDIR);
exit(1);
}
if(chroot(FTPDIR)) {
perror(FTPDIR);
exit(1);
}
execl(FTPEXEC,"ftpd","-l",(char *)0);
perror(FTPEXEC);
}
And put that in inetd.conf to be invoked instead of ftpd. Then
make sure ftpd (statically linked, of course) is in ~ftp/bin/ftpd, along
with "ls" and the rest of the ftp environment. On systems with dynamic
linking and whatnot it may require some fiddling. I also link my ftpd
against a version of the syslog() code [part of the toolkit] that uses
UDP messages instead of writing to the bound UNIX domain socket.
mjr.
|
|