So I'm trying to get a handle on how Linux's mount namespace works. So, I did a little experiment and opened up two terminals and ran the following:
Terminal 1
root@goliath:~# mkdir a b
root@goliath:~# touch a/foo.txt
root@goliath:~# unshare --mount -- /bin/bash
root@goliath:~# mount --bind a b
root@goliath:~# ls b
foo.txt
Terminal 2
root@goliath:~# ls b
foo.txt
How come the mount is visible in Terminal 2? Since it is not part of the mount namespace I expected the directory to appear empty here. I also tried passing -o shared=no
and using --make-private
options with mount
, but I got the same result.
What am I missing and how can I make it actually private?
man mount
.--make-private
is not what I want. But, isn't that the point of mount namespaces (that they're not system wide)?