Re: f26 chroot PATH doesn't include /bin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/31/2017 09:41 AM, Mike Wright wrote:
> On 08/31/2017 09:26 AM, Rick Stevens wrote:
>> On 08/31/2017 08:34 AM, Kevin Cummings wrote:
>>> On 08/30/17 15:16, Tony Nelson wrote:
>>>> I have an old CentOS5 that I chroot into.  On my old f20 box, PATH
>>>> included /bin, but now on f26 it does not.  I don't understand how
>>>
>>> For a while now, /bin should be a link to /usr/bin.  is /usr/bin in the
>>> PATH?
>>
>> That's the most likely issue here. The OP keeps referring to an F20
>> box and IIRC that predates the /bin<-->/usr/bin changeover.
>>
>> To answer the question, bash has an initial PATH compiled into it.
>> What that PATH contains depends on how bash was built and how bash
>> was launched (they inherit the environment of the launching process--
>> interactive or not). The vast majority of systems bugger that default
>> path by use of the /etc/bashrc script and possibly custom scripts in
>> /etc/profile.d.
>>
>> Interactive (login) shells are typically launched by the login process
>> and inherit the login process' PATH (see "man login" for details). The
>> additional stuff (/etc/bashrc, /etc/profile, etc.) are also invoked.
>>
>> A chrooted shell gets its environment from the chroot process and would
>> run any normal startup scripts, but they'd be from the chrooted /etc,
>> not necessarily the root system's /etc.
> 
> How about using "env":  env PATH="new_path" chroot /some_dir
> 
> Wouldn't this preempt the passed PATH, profile, bashrc, and the dot
> files?  If so, chroot could be defined as an alias to "env ... chroot"
> and thereby eliminate the problem.

I suppose you could:

	env PATH="/bin:/sbin:/usr/bin:/usr/sbin" chroot /some_dir

Remember that the chrooted shell would be looking for the directories in
the "PATH=" under "/some_dir", since the shell would rooted there.

Chroot jails can be complex to set up. You need all the utilities you
need in the chroot along with their required libraries, etc., etc.
It might be better to look at things like sandboxes (based on selinux),
lxc (linux containers) or firejail (based on linux namespaces and other
goodies).

Oh, wow, my brain is starting to cramp on this. :p
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-    Admitting you have a problem is the first step toward getting   -
-    medicated for it.      -- Jim Evarts (http://www.TopFive.com)   -
----------------------------------------------------------------------
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux