/dev/null in a chroot

Bill Moran wmoran at collaborativefusion.com
Sun Jan 7 16:02:29 UTC 2007


"Michael Grant" <mgrant at grant.org> wrote:
>
> I chrooted apache to /www.
> 
> In order to run a java program from a web page, java needs a /dev/null
> inside the chroot.
> 
> I don't want to create another whole /dev/ dir with all the disk raw
> devices there to be read for anyone who cracks root.  I just want a
> /www/dev/null file.
> 
> I tried creating a node with mknod exactly like the node in /dev but
> it doesn't work in freebsd 6.  /dev/ is special now and you can't just
> create nodes anywhere like the old days.
> 
> Is there a way to create a /www/dev/null which acts just like /dev/null?

devfs does this now.  You can mount a second devfs under /www/dev/, or
anywhere else for that matter.

Controlling which device nodes show up is done by devfs rulsets.  See
the man page for devfs for details.

-Bill


More information about the freebsd-questions mailing list