Ключевые слова:freebsd, dhcp, chroot, (найти похожие документы)
From: soup4you2
Newsgroups http://freebsdaddicts.org
Date: Mon, 16 Jan 2004 14:31:37 +0000 (UTC)
Subject: Запуск dhcpd в chroot
Оригинал: http://freebsdaddicts.org/modules.php?name=Sections&op=viewarticle&artid=15
Level: Intermediate
OS: FreeBSD
Created: 1/12/04
Author: soup4you2
Originally Posted On BSDHound.com
Introduction:
This is really simple but can tend to drive a person crazy.. so i thought i would make a series of how to's on chrooting various applications.
I'm going to make the assumption you already have it installed and configured and working properly..if not then do that...the scope of this howto is just to simply chroot it.
# mkdir -p /usr/chroot/dhcpd
# mkdir -p /usr/chroot/dhcpd/dev
# mkdir -p /usr/chroot/dhcpd/etc
# mkdir -p /usr/chroot/dhcpd/usr/lib
# mkdir -p /usr/chroot/dhcpd/usr/libexec
# mkdir -p /usr/chroot/dhcpd/usr/local/sbin
# mkdir -p /usr/chroot/dhcpd/usr/local/etc
# mkdir -p /usr/chroot/dhcpd/var/db
# mkdir -p /usr/chroot/dhcpd/var/run
# mknod /usr/chroot/dhcpd/dev/null c 2 2
# chown root:sys /chroot/dhcpd/dev/null
# chmod 666 /chroot/dhcpd/dev/null
# BPF="`ls -l /dev/bpf0 | awk '{ print $5; }' | sed -e 's/,//g'`"
# export BPF
# cd /usr/chroot/dhcpd/dev
# mknod bpf0 c $BPF 0
# mknod bpf1 c $BPF 1
# chmod 0600 bpf*
# cp /usr/lib/libc.so.5 /usr/chroot/dhcpd/usr/lib/libc.so.5
# cp /usr/libexec/ld-elf.so.1 /usr/chroot/dhcpd/usr/libexec/ld-elf.so.1
# cp /usr/local/etc/dhcpd.conf /usr/chroot/dhcpd/usr/local/etc/dhcpd.conf
# cp /usr/local/sbin/dhcpd /usr/chroot/dhcpd/usr/local/sbin/dhcpd
# cp /var/db/dhcpd* /usr/chroot/dhcpd/var/db/
Now test it:
# chroot /usr/chroot/dhcpd /usr/local/sbin/dhcpd
Congrats... now just edit your startup file.