TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How can I find or identify all chrooted directories in Linux?

3 pointsby finidabout 8 years ago

2 comments

LeoSolarisabout 8 years ago
All you do is escape the &quot;jail&quot; and ls -r the whole system. Chroot is a shell trick that basically creates an alias for &#x2F; pointing at an arbitrary folder. Any process that is spawned in that aliased environment have the folder returned as &#x2F;. (Chroot &quot;jails&quot; are pretty easy to break out of, by the way, and is not a security measure.)<p>I don&#x27;t know if there is a way to force arbitrary running processes to output their root directories in such a way that would link to the aliased folder.<p>That question is somewhat like asking if there is a way to show which folders your shell was in for every time you&#x27;ve called sudo.
评论 #14007904 未加载
评论 #14008723 未加载
wahernabout 8 years ago
Simple:<p><pre><code> $ for F in &#x2F;proc&#x2F;*&#x2F;root; do readlink &quot;$F&quot;; done </code></pre> If you need something you can cut+paste:<p><pre><code> $ sudo sh -c &#x27;for F in &#x2F;proc&#x2F;*&#x2F;root; do readlink &quot;$F&quot;; done&#x27; | sort -u</code></pre>