On 07 Oct 2016 14:33, Michael Kerrisk (man-pages) wrote:
On 10/06/2016 07:23 PM, Mike Frysinger wrote:
quoted
If the target process is in a different mount namespace, the root symlink
actually shows that view of the filesystem. As an example:
/* Terminal 1 */
$ unshare -Urnm
# mount -t tmpfs tmpfs /etc
# mount --bind /bin /dev
# echo $$
17168
/* Terminal 2 */
# ls /etc # Normal view of /etc files.
# ls /proc/17168/root/etc # Empty view of the tmpfs.
# ls /dev # Normal view of /dev files.
# ls /proc/17168/root/dev # Contents of /bin files.
Thanks for the patch! And thanks for the commit message, which is I think
actually useful text for the man page itself, so I added it (in somewhat
modified form) to the page itself.
looks like some formatting is off ?
-mike
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -1525,7 +1525,7 @@ and in that shell we create some new mount points:
$ \fBPS1='sh1# ' unshare \-Urnm\fP
sh1# \fBmount \-t tmpfs tmpfs /etc\fP # Mount empty tmpfs at /etc
sh1# \fBmount \-\-bind /usr /dev\fP # Mount /usr at /dev
-sh1# \fBecho $$
+sh1# \fBecho $$\fP
27123
.in
.fi
@@ -1533,10 +1533,10 @@ sh1# \fBecho $$
In a second terminal window, in the initial mount namespace,
we look at the contents of the corresponding mounts in
the initial and new namespaces:
-
+
.nf
.in +4n
-$ \fBPS1='sh2# ' sudo sh
+$ \fBPS1='sh2# ' sudo sh\fP
sh2# \fBls /etc | wc \-l\fP # In initial NS
309
sh2# \fBls /proc/27123/root/etc | wc \-l\fP # /etc in other NS