[Charlotte.PM] Doing a chroot in Perl
Christopher Fowler
cfowler at outpostsentinel.com
Mon Aug 28 14:47:23 PDT 2006
On Mon, 2006-08-28 at 16:19 -0400, William McKee wrote:
> On Mon, Aug 28, 2006 at 03:39:47PM -0400, Christopher Fowler wrote:
> > This is part of my script execution that I asked about a week or so ago.
>
> I'm not sure I saw that hit the list. Are you sure you sent it?
I sent it to another list. Sorry for confusion.
>
>
> > I am now going to extract the script from the database and place it in a
> > chroot environment. I will then execute it from there. I'm using this
> > test program before I integrate it into the main code.
>
> I had to make a few tweaks to get that script to work (e.g., change
> $root and the getpwnam argument). Even after doing so, I didn't have
> much luck getting a chroot environment. The chroot function says that it
> is restricted to the superuser which may be why I'm not seeing much
> change as I'm running it under my login. If I use sudo to run it, the
> script dies at line 28 (getpwnam).
It is having a problem reading /etc/passwd in the chroot environment. I
want to switch to user tomcat inside the chroot so I waited till after
the chroot to read /etc/passwd.
>
>
> > $ ps > /
>
> What does that command do in Busybox? In bash, it generates an error
> message.
>
It displays the ps output and redirects it. I should read:
ps > /out.txt
>
> > $ ls -l /out
> > -rw-r--r-- 1 500 500 6998 Aug 26 23:42 /out
That would be out.txt
>
> Who is user 500? tomcat?
>
Yes
>
> > As you can see /out is owned by tomcat.tomcat but why was he able to
> > place anything in /out? Probably something simple I'm not seeing or
> > forgot to do.
>
> I must not be following you where. You've created a chroot environment
> that contains an /out directory owned by tomcat. This user has the
> permissions to write to the /out directory. Are you asking why the user
> was able to create the directory in the first place?
I'm asking why was tomcat able to redirect the output to a file name
out.txt in / of the chroot. / in the chroot is owned by root.
>
>
> William
>
More information about the charlotte
mailing list