saving your ass(ets) with chroot
DESCRIPTION
Saving Your Ass(ets) with chroot. Alan Bailward April 15, 2004 For the Fraser Valley Linux Users Group. What is chroot?. Allows running of commands with an arbitrary root directory Syntax: chroot NEWROOT [command] Used to “jail” applications - PowerPoint PPT PresentationTRANSCRIPT
Saving Your Ass(ets) with chroot
Alan Bailward <[email protected]>April 15, 2004
For the Fraser Valley Linux Users Group
What is chroot?
Allows running of commands with an arbitrary root directory
Syntax: chroot NEWROOT [command]
Used to “jail” applications
Mostly used for security applications
i.e.: servers
Getting in Trouble
Easy to have Linux problems
Errors on install
Broken kernel
Broken lilo
Normally you’re out of luck, to a degree, or need to deal with accessing things from a BootCD
Getting Out of Trouble
The old way
The Old way
Get to your system
Floppy
BootCD
Fix it
Mess with lilo/lilo.conf
Compile kernel, hope it works
Getting Out of Trouble
The New Way
Using chroot
Lets you access your system as it was
Full access to accurate /proc and /dev
No funky pathing
Easy to jump in and out of
How To Use chroot 1
Boot with BootCD
mkdir /mnt/new
mount /dev/hda1 /mnt/new
mount /dev/hda2 /mnt/new/boot
mount /dev/hda3 /mnt/new/var
How To Use chroot 2
mount -o bind /proc /mnt/new/proc/
link the “real” /proc into your new file structure
mount -o bind /dev /mnt/new/dev/
ditto for /dev (only for devfs systems)
How To Use chroot 3
cp /etc/resolv.conf /mnt/new/etc/
need accurate network info
chroot /mnt/new /bin/bash
enter the system
env-update # gentoo only
update environment settings
How To Use chroot 4
You are now in a shell that is your old system
cd / puts you in your old / (really /mnt/new/)
Can run lilo, compile kernels, etc
To exit, type ‘exit’ to exit, then unmount disks and reboot
Live Demo
Questions?