Skip to content
Advertisement

Tag: linux-namespaces

Editing root-owned files after “unshare -Ur”

Say I am in the initial user namespace and there is an empty root-owned file in some directory: Now I am switching to a new user namespace with unshare -Ur. In this namespace, root.txt is reported to be owned by “nobody” because original root uid(0) is not mapped to the new namespace: Then I use vim to edit this file.

‘unshare’ does not work as expected in C api

This sequence of commands works: However, the corresponding C program does not work as expected (it seems it does not unmount the previous /proc, and also it provides EBUSY trying to unmount the devpts): I omitted here error checking for readability I think that unshare or unmount does not work as expect: even if it returns zero, it seems that

grantpt report error after unshare

I have a small program, which tries to create a pseudoterminal after unshare. the output is: The Code: If I remove flag |= CLONE_NEWUSER;, there is not error reported. Can you help to explain why this happens? thanks in advance! Answer Since I’ve had the same issue I have also looked into this. Here are my findings: grantpt(3) tries to

How to add a name to namespace?

As I know, I can use the “clone” to create a process and a namespace, but the namespace created in this way has no name. For example, I create a network namespace with the parameter: CLONE_NEWNS, but in the command “ip netns list”, there is no namespace list because the namespace created has no name. But I can use the

Advertisement