howto use chroot
hi there,
can someone plz point me to certain sites where in I can learn howto use chroot.. tried googling a lot but couldnt find any thanks. danish |
tried googling a lot but couldnt find any
LQ has site search. We've got a lot of topics going on. Try it next time. You won't be disappointed, even if your search-fu is at an alltime low. Check out the LQ FAQ: Security references: post #4: "Chroot, chrooting, jailing, comparimization". |
You searched Google and couldn't find anything? First hit for chroot howto:
http://www.tjw.org/chroot-login-HOWTO/ Also, search for "jailkit" - first hit: http://olivier.sessink.nl/jailkit/ Both should point you in the right direction, I hope this was helpful (it doesn't make any sense to reinvent the wheel by copy&pasting the howtos here). Let us know if you run into trouble configuring them. :) |
|
Here is my own version based on usage.
Chroot is a mean of jumping from a Linux A into another Linux B. The steps involved are just booting up Linux A either an installed Linux in the hard disk or from a Live CD, make a temporary partition in /mnt, mount the partition of Linux B and do a chroot. The result afterward is you will be using the kernel of Linux A but have the access of the Bash shell of Linux B. This facility allows you to repair Linux B especially if it is unbootable. If LInux B is in partition hda7 the commands after booting Linux A to chroot to Linux B are Code:
mkdir /mnt/hda7 Code:
exit Since you need root privilege to chroot so on gaining access into the Linux B you will remain as root and so it can be a form of hacking because you break into an installed Linux without knowing any of its passwords. |
i have a bunch of scripts on my system similar to this. say gentoo is installed on hda6. generally you can start another instance of X after chrooting with startx -- :1
you can be running several versions of linux at once along with their graphical environments, switching between themw ith ctl-alt-F7 . . F8 . . . F9 some of the info is from a multiple distributions for development howto on the web. http://www.faqs.org/docs/Linux-mini/...istro-Dev.html umount /hda1 umount /hda2 mount /dev/hda6 /mnt/gentoo mount --bind /proc /mnt/gentoo/proc # mount --bind /tmp /mnt/redhat/tmp # chroot /mnt/gentoo /bin/bash --login startx chroot /mnt/gentoo /bin/bash umount /mnt/gentoo/tmp umount /mnt/gentoo/proc umount /mnt/gentoo mount /dev/hda1 /hda1 mount /dev/hda2 /hda2 |
thank you all for your help...i tried out all the pages that you all had provided but im sorry i couldnt understand much....though i did try out the man pages and from a bit of reading i did...
#ldd /bin/ls after getting all the shared libraries i cp'd them to a directory (/home/dipshi) in the same structure that i got...for eg.../home/dipshi/lib/(shared libraries)..i then even copied ls and bash into the directories inthe same i did #ldd /bin/bash and cp'd all the libraries in the appropriate structure...and then i did #chroot /home/dipshi/ bash-3.00# the ls was working fine... right now im trying to chroot the /var/tomcat-jakarta and /usr ill be neeing your help with that..ill get back whenever i get a problem thank you very much Danish |
hello everyone...as i had told u i would be working on /var/jakarta...
well i did chroot it and made bin, etc, usr/sbin, lib under /var/jakarta-tomcat and copied all the libraries into it......although i could go into jakarta after chroot ing it...i also wanted to create a user under jakarta so that the user could only work under the webapplication direc under jakarta...so i also copied /usr/sbin/useradd to jakarta in the appropriate dir format..after chrooting i tried useradd username, it didnt give any errors so i assumed that a user was created..similarly i copied userdel but when i tried to run userdel..it gave me an error that there was no such user.... the following dir were made by me #mkdir -p /var/jakarta/bin #mkdir -p /var/jakarta/lib #mkdir -p /var/jakarta/etc #cd /var/jakarta #touch passwd #touch group on opening /var/jakarta/etc/passwd..it showed me entries that a user was created with all the normal entries including a home dir...but when i personally created a home dir under jakarta, no home dirwas created for the user thanks danish |
dsids>
Could you please use your shift key when appropriate, and actually spell out the words you want to use? Thanks. |
thank you KimVette..I'll work on your advice....
I tried out jailkit and worked on the example that was given in the documentation available on the jailkit website..every command mentioned in the documentation jailkit worked fine but I couldnt figure out how would I come to know whether the user is inside the jail..... for eg, if I do #chroot /home/username...then by doing bash#pwd I get / as the new root directory instead of /home/username but my problem is that I cant figure out how to do the same thing using jailkit.... any help will be greatly appreciated thanks danish |
i actually enjoy short bursts of leet speech. reading your posts, i didn't even notice the u and plz myself. i think it gives more flavor to things.
on the main question, perhaps you can do a minimal install of linux on a different drive or partition, then get the chroot working, and start deleting stuff out of the environment. perhaps one of those minimal 1 2 or 3 floppy distributions or something like peanut. http://www.linuxlinks.com/Distributions/ |
Quote:
Quote:
|
Location: Bawstun area
flavor. i understand though. i have more than enough of my share of things that get on my nerves. |
chroot example links
Here are two links for RHEL 7 users.
Chroot Jail the Apache Web Server in RHEL/CentOS 7 Chrooted Collaborative Directory for SFTP users in Linux |
chroot - Wikipedia
https://en.wikipedia.org/wiki/Chroot Jump to Linux host kernel virtual file systems and configuration files - A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally cannot access) files outside the designated directory tree. What does chrooted mean? - LinuxQuestions https://www.linuxquestions.org/quest...d-mean-355296/ You can also search the idea for Sandboxing :) |
All times are GMT -5. The time now is 12:01 PM. |