A solution is to use namespaces through the unshare command.
However, to avoid unshare being run as root, we need to use the setuid bit on it.
sudo groupadd unshare
sudo adduser $USER unshare
sudo chmod u+s /usr/bin/unshare
sudo chown root:unshare /usr/bin/unshare
Then (possibly a new terminal is required):
unshare -m
We should now have a shell with $ user sign, not # root sign. Now, we need to explicitly specify private or rprivate in the mount options (explaination in sources below) and then launch encfs.
enc_dir="/path/to/enc_dir"
mount_point="/path/to/plain_dir"
sudo mount --bind "$mount_point" "$mount_point"
sudo mount --make-private "$mount_point"
encfs "$enc_dir" "$mount_point"
Processes started from this shell will be able to view the mount point. Other processes won't.
Source: Hiding an encrypted folder in a shared system without root access (unshare -m) commented by Philipp Wendler & Cant' get per process mount namespaces to work answer by ub1quit33
- - , .
برچسب:
نویسنده: استخدام کار