I want to have different mounts that are seen only by a specific process or user. One use case I am thinking about is when I want to mount a unionfs or aufs that will be available for one user. So I can have multiple mounts on the same mount point that are different for different users.
Here is how to enable per user mount namespaces in Ubuntu 12.10 using pam_namespace:
Edit /etc/security/namespace.conf
Uncomment the last lines. For safety, add your current user to the list of exclusions.
Edit
/etc/security/namespace.init
and change#!/bin/sh -p
to#!/bin/bash --noprofile
or to#!/bin/sh
This is becausesh
is actuallydash
.For testing edit
/etc/pam.d/su
and append at the end of file:Test on a test user:
As test user run:
This will generate a command like:
Run the generated diff from test user shell and from root. From the test user you will have no output, but from the root you will see something like:
The test_user
/tmp
folder will be mapped as/tmp/tmp-inst/test_user
and it will be accessible only to this user.Why not just mount at ~/specificmountpoint. Set the permissions accordingly. Every user will have the same (almost) mout point.
It looks like nowadays it's possible:
At least, in theory. Check this article for more details: http://lwn.net/Articles/531114/