As you can see from the output of this program, when I attempt to chroot a directory other than my home directory, chroot fails. But the permissions and ownership of the two directories is exactly the same.

Thus this failure is occuring due to some variable not stated in the chroot manpgage and that is not file ownership or permissions.

So, if some kind genie/guru could tell me the appropriate magic incantation to cast over this code to get it to chroot in both cases, I would appreciate it.

This is Perl 5.6.1 by the way.

sub ls_ld { my @dir = split '/', $_[0]; my $ret_text; for (2 .. $#dir) { my $path = join '/', @dir[0..$_]; my $ls_ld = `ls -ld $path`; $ret_text .= $ls_ld; } $ret_text; } my %dir = ( home => '/home/tmbranno', other => '/home/tmbranno/src/Net/FTPServer/ARU/ftp-dir/t' ); map { chroot $dir{$_} or die sprintf "cannot chroot: $dir{$_}: $!\n all paths of this:\n%s" +, ls_ld($dir{$_}) ; } (keys %dir);

{ap555sun:tmbranno:tmbranno_1693779_arulinkftp:arudev}133> /home/tmbra +nno/src/te sts % perl chroot.pl perl chroot.pl cannot chroot: /home/tmbranno/src/Net/FTPServer/ARU/ftp-dir/t: Not own +er all paths of this: drwxr-xr-x 19 tmbranno g680 8192 May 8 15:52 /home/tmbranno drwxr-xr-x 15 tmbranno g680 8192 May 3 09:59 /home/tmbranno/s +rc drwxr-xr-x 3 tmbranno g680 96 May 3 09:59 /home/tmbranno/s +rc/Net drwxr-xr-x 3 tmbranno g680 96 May 3 09:59 /home/tmbranno/s +rc/Net/FTPServer drwxr-xr-x 7 tmbranno g680 8192 May 8 15:35 /home/tmbranno/s +rc/Net/FTPServer/ARU drwxr-xr-x 4 tmbranno g680 96 May 8 15:26 /home/tmbranno/s +rc/Net/FTPServer/ARU/ftp-dir drwxr-xr-x 2 tmbranno g680 96 May 8 17:20 /home/tmbranno/s +rc/Net/FTPServer/ARU/ftp-dir/t {ap555sun:tmbranno:tmbranno_1693779_arulinkftp:arudev}134> /home/tmbra +nno/src/te sts %

In reply to chroot fails for no obvious reason by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.