On 24/09/06, guy keren <[EMAIL PROTECTED]> wrote:
according to the man page, chroot does NOT change the directory. you need to change it explicitly in your code. so your program did not create the so-called "root jail" properly. if you had added a 'chdir' into the new directory, and then did 'chroot "."', then you'd have done your job (more) properly.
Just run this program from inside a root jail and you'll get a shell outside it (e.g. I have an old Sarge partition so I chrooted into it and after running this program I got a shell outside it). The code isn't elegant and the program's success has nothing to do with having a /bin/sh under the chroot jail (because the last step runs /bin/sh from outside the jail) but otherwise his later explenation is accurate. (for instance - the correct loop condition should be to stop when stat(.)==stat(..) which indicates that he reached the "real" root, and he can probably 'chdir "../../../../../....."' in each iteration to speed things up). Cheers, --Amos -- "Military justice is to justice what military music is to music" ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
