chroot question

Polytropon freebsd at
Wed Apr 22 09:53:59 UTC 2015

On Tue, 21 Apr 2015 15:34:47 -0600, jd1008 wrote:
> As root, I ran
> chroot --userspec=user2:user2 /home/user2
> chroot: failed to run command ‘/bin/bash’: Permission denied
> The dir /home/user2 has in it
> all the *bin and *lib  (links) and usr/*bin and usr/*lib files and subdirs.

That might be the answer: If /bin/bash really exists (which is
a "non-standard extension" on FreeBSD) _and_ it's a symlink, a
test "if it's an executable" will probably fail.

If you can place an _actual_ binary of /bin/bash, try that, and
repeat the test. If not, specify its actual location for that
user (using "chsh <username>"). This is bash's standard installation
target on FreeBSD:

	% which bash

Keep in mind that things like #!/bin/bash are considered a
"Linuxism" and therefore NOT PORTABLE. Butif I remember
correctly, you can run "make configure" for the bash port
and set an option to enable that kind of functionality.

Anyway, check "ls -la /bin/bash" for anything suspicious,
just to make sure _what_ permissions could have been denied,
and _why_.

> So, what is chroot good for???

See "man chroot": "change root directory". :-)

I have excluded the Fedora list you've been parallel-posting
to because I'm not subscribed there. I assume that your question
targets FreeBSD. If _not_, consult "info chroot" on your Linux

Fedora Community Users Support <users at>

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list