Currently, the unshare(1) command allows to disassociates:
- mount namespace
- UTS (since kernel 2.6.19, independent hostname and domainname)
- IPC namespace (System V message queues, semaphores, and shared memory)
- network namespace (since kernel 2.6.24, independent IP stacks, IP routing tables, firewall, ...)
Probably the most attractive is unshared mount namespace (see Mike Hommey's "newns" or pam_namespace).
For example I have two xterms, let's start a new bash with unshared mount namespace in the first session:
Session1:
Session2:
# unshare --mount /bin/bash
# mount /dev/sda1 /mnt/test
# grep test /proc/mounts
/dev/sda1 /mnt/test ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0
... the /mnt/test filesystem is visible in the Session1 only. That's all, pretty simple and pretty useful :-)
# grep test /proc/mounts
# ll /mnt/test
total 0
Interesting. This is a nice feature. Can you think of any use cases? I'd like to use it but don't know where. :)
ReplyDeleteOne example would be mounting something on a multiuser system, where you don't want the other users see your (private) mountpoints.
ReplyDeletevery nice if you use fuse/ssh to mount a remote home dir
ReplyDeleteVery good! unshare definantly looks intersting
ReplyDeletebut it seems the name 'unshare' is already a command for NFS. Is there any chance that util-linux-ng's unshare would cause a conflict with nfs' 'unshare'?
> the name 'unshare' is already a command for NFS
ReplyDeleteon Linux? I see the unshare NFS command on SCO or Sun. For example:
http://www.math.utah.edu/~beebe/unix/u/unshare.html
Oops... Sorry. I just saw the results in Google when I was looking for the usage for util-linux-ng's unshare, and I got worried before I read that it was for Sun's NFS (actually I thought that NFS would have the same commands across the platforms anyway).
ReplyDeleteBTW: I installed the NFS tools in Ubuntu, and there was no unshare command.
Sorry about that.
I got worried before I read that it was for Sun's NFS (actually I thought that NFS would have the same commands across the platforms anyway).
ReplyDeletehis is a nice feature. Can you think of any use cases? I'd like to use it but don't know where.
ReplyDeleteis already a command for NFS. Is there any chance that util-linux-ng's unshare would cause a conflict with nfs' 'unshare'?
ReplyDeleteCan you think of any use cases? I'd like to use it but don't know where.
ReplyDeleteWhat does this mean? Is it like avh-p3200bt?
ReplyDeletegreat blog very informative
ReplyDeleteThanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future.
ReplyDeleteI have just started to learn some Linux. This will probably be useful for me. Thanks!
ReplyDeleteVery handy as I just started learning all the programming code of linux. This was beneficial.
ReplyDeleteThis usually necessitates that we broaden our thinking and explore less conformist ways of meeting and processing information.
ReplyDeleteI’ll immediately grab your rss as I can not find your email subscription link or e-newsletter service. Do you have any? Please let me know so that I could subscribe. Thanks.
ReplyDeletegreat article , really well write
ReplyDeletenice article , really worth the read
ReplyDeletenice topic , its good that you have talked about it
ReplyDeletegreat article , great topic !
ReplyDeleteInteresting post about 'unshare(1)'. Thanks for sharing.
ReplyDeleteroku reviews | roku deals | hulu roku
Great website, looks very clean and organized. Keep up the good work!
ReplyDeleteI am not familiar with the use of unshared. Is it good for games or for memory?
ReplyDeleteThe function for the Linux System is it?
ReplyDeleteThis drew roars of chants from campaign headquarters in Chicago, where staff chanted "Plouffe" repeatedly, forcing him to give a talking
ReplyDelete