The tag has no usage guidance, but it has a tag wiki.

learn more… | top users | synonyms

1
vote
1answer
24 views

How to bind (or remap) a socket with an abstract name to a path?

In our system (Linux 4.4) we see a a unix socket with an abstract namespace (those starting with @ with no corresponding file on the file system). Showing its details with lsof reports: serv 7539 ...
1
vote
1answer
40 views

Connect network namespace to internet

My scenario is this: I want to be able to execute a program in a separate namespace with a network interface of its own. But I also want it to be able to access internet though my physical network ...
1
vote
0answers
45 views

Persistent network namespace configuration

When creating a namespace with ip netns add <namespace> the namespace and it's related config is deleted on reboot along with created interfaces like veth pairs. What is the correct way to: ...
3
votes
1answer
55 views

Why does child with mount namespace affect parent mounts?

I am trying to understand Linux namespaces using a Debian jessie server where I have root access. Consider this C code: # /tmp/test.c #define _GNU_SOURCE #include <sched.h> #include <stdio....
0
votes
0answers
76 views

Non-Root Container

I'm attempting to create some kind of gentoo "subsystem" without root permissions. I've encountered a problem with my approach and I'm wondering if it's possible to do or not. The way I'm attempting ...
1
vote
0answers
30 views

unshare -m seemingly not creating mount namespace

I ran unshare -mfp sh -c 'mount -tproc none /proc ; ls /proc' That printed a /proc with only directories for PID 1 and PID 3, and exited, leaving me back in my old prompt in the root namespace, as ...
1
vote
1answer
23 views

remove link from Linux namespace

I created a namespace in Linux with 'ip netns add foo', created a pair of veth interfaces and moved one in the namespace. I set up IP addresses etc., so that now I can ping my 'foo' namespace from the ...
4
votes
0answers
48 views

LXC: Any security difference between root and end-user owned unprivileged containers?

I intend to use LXC containers to isolate most of the network facing services. As per my understanding, I have mainly two ways to do this: Create unprivileged containers owned by root. In this case,...
0
votes
0answers
57 views

Trying to run OpenVPN in Network Namespace

I want certain apps to access the internet via OpenVPN. I found a solution in the final answer/comment at the bottom of this question/thread here: Feed all traffic through OpenVPN for a specific ...
2
votes
0answers
122 views

Netlink access inside a network namespace

I'm trying set up an IPsec gateway (strongSwan) on a Raspberry Pi 2. The Pi was already providing a number of services on the LAN using a private IP address. My initial attempt to turn it into an ...
1
vote
1answer
28 views

Starting isolated namespace inside network namespace

I've managed to create two network namespaces (ns1 and ns2) and connect them via veth connection. They can ping each other fine, and even ssh one into another (provided I started sshd). What I would ...
2
votes
1answer
55 views

Compute total CPU usage of a PID namespace

I'd like to monitor the CPU usage for all processes in a particular PID namespace. I'd like to do it programmatically (C, if possible). I have an idea of how to do it, but I'd like to know if Linux ...
3
votes
2answers
117 views

Is it possible to mount a device in a process' namespace after unshare()

Say I have a process with an isolated MOUNT namespace pid 1200 the process called unshare() to isolate its namespace from the parent process. I then want to mount a device only accessible outside pid ...
2
votes
1answer
74 views

Is it possible to run 'unshare -n [program]' as an unprivileged user?

I want to run a program without any internet access, e.g. unshare -n ping 127.0.0.1. As an unprivileged user, it returns Operation not permitted, as a privileged user, it returns the desired ...
0
votes
0answers
33 views

mount namespace not work in ubuntu whether 15.04 or 14.04

NOTE: Referencing this Q&A: Why is my bind mount visible outside its mount namespace? It gave an unshare example, but it did not work in Ubuntu. I tried on Ubuntu 15.04, with util-linux 2.25. I ...
5
votes
2answers
292 views

Why is my bind mount visible outside its mount namespace?

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@...
2
votes
1answer
66 views

Is there a way to isolate a running program from the rest of a Linux system?

First of all, I know about virtualisation and containers. I'm sure "he wants containers" is what popped in your mind. (Don't deny it!) However containers are like chroot: if you want to execute bash ...
1
vote
1answer
174 views

SSH: shell opened in IP namespace

I'm trying to force users logging in through SSH to have a shell inside IP namespace. I've tried replacing the shell in /etc/passwd with something like ip netns exec sshns /bin/bash but it didn't ...
5
votes
1answer
117 views

PID in arch-chroot is incorrect

I am trying to run a python script in a chroot (specifically, the chroot is created with arch-chroot). The python script relies on os.getpid(), but this seems to be returning an incorrect PID within ...
1
vote
0answers
22 views

Is an unprivileged LXC where the host user itself is mapped to 0 less secure of one where one of its subids is mapped to 0, and why?

Instead of creating "common" LXC unprivileged containers where all the users are mapped to (unprivileged) subuid/gid of my host user, I'm considering a mapping where my host user itself will be mapped ...
1
vote
1answer
323 views

What characters are valid to use in filenames? [duplicate]

I seems like it is possible to create filenames in unix with just about any valid character. touch \; && touch \\ && touch \" && touch $'\n' && touch $'\t' && ...
1
vote
0answers
106 views

Recursively unmount Bind mount in both User and Mount namespace

I am trying to use recursive bind mount in a new user namespace and mount namespace. This is what I do. Assume /foo/bar/ and /foo are both mount points. Firstly I do mount --rbind /foo/bar/ /baz, and ...
1
vote
1answer
136 views

Allow a single process to access a file

If I am the owner of a file, then is there a way I can give another process (running under another user that doesn't have read/write permission to that file) permission to access it? I want only that ...
3
votes
0answers
84 views

Sandboxing a binary on linux

I am trying to understand various options I have to restrict/sandbox a binary in Linux. I see that I can use namespaces and cgroups like docker does. I could use SELinux like this link suggests. Which ...
2
votes
0answers
65 views

What happens if the last process in a namespace exits?

I am running Linux. I have a single process in a mount namespace. I did in this process a mount -t tmpfs tmpfs /mountpoint. What happens if the process exits and there are no more processes in ...
1
vote
0answers
34 views

Is it allowed to assign one range of subordinate IDs to two different users?

Is it allowed to assign the same range of subordinate user and group IDs to different users on the system defining the subordinate IDs? Please provide sources for your answer. The idea here would ...
1
vote
0answers
143 views

running a process in another namespace

I would like to run a new process (for example an xterm) in another network namespace. This could be done like this: sudo ip netns exec otherns sudo -u $USER xterm This command looks a bit ...
1
vote
1answer
96 views

Using a VPN for certain applications via a network namespace

I am trying to use a network namespace for VPN-specific traffic, using this guide: https://schnouki.net/posts/2014/12/12/openvpn-for-a-single-application-on-linux/ on Debian. Everything works with ...
1
vote
0answers
51 views

icmp limited in many network spaces?

I wrote small script do show example usage of ip netns on unused class size C (here changed into 192.168.10) #!/bin/sh network=192.168.10 for id in `seq 0 127`; do ip netns del test-$id; done; ...
2
votes
1answer
116 views

Re-enter PID 1 namespace

I'm trying to enter PID namespace that process with PID 1 is in from a process cloned with CLONE_NEWPID. I keep getting Invalid argument error. In other words, I clone a child process with clone() ...
7
votes
1answer
3k views

What's a UTS namespace?

The man page of unshare says: UTS namespace setting hostname, domainname will not affect rest of the system (CLONE_NEWUTS flag) What does UTS stand for?
2
votes
1answer
422 views

Is Traffic control inside namespace on ports created by OpenvSwitch supported?

I am trying to limit the bandwidth of an interface inside a namespace using tc without much success. Seems it's not supported according to https://lists.linux-foundation.org/pipermail/containers/2009-...
5
votes
1answer
330 views

View/manipulate mount namespaces in Linux

Is there any way to view or manipulate the mount namespace for an arbitrary process? For example, a docker container is running which has a local mount to an NFS server. It can be seen from inside ...
1
vote
0answers
250 views

Running HTTP process as a sole child in PID/NET namespace

First time posting here so I appreciate your help and patience. After reading about namespaces, looking on various forums including this thread and trial and error I'm still looking for answers for a ...
1
vote
1answer
149 views

How to map IP by iptables ?

I create a network namespace In this namespace, I open a nginx So for now, I can visit web server by 172.17.0.2 What I want to do is mapping this IP to 127.0.0.1 Lets say if I visit 127.0.0.1, I ...
2
votes
3answers
2k views

linux namespace, How to connect internet in network namespace?

I want to test linux network namespace. The current problem is I cannot connect internet in the namespace here is my commands: 1 Create network namespace netns1, create a pair of veths (A and B) ...
3
votes
1answer
3k views

per process private file system mount points

I was checking unshare command and according to it's man page, unshare - run program with some namespaces unshared from parent I also see there is a type of namespace listed as, mount ...
1
vote
0answers
346 views

How to start a process chain from the shell

Is it possible and if so how do I: Start a /bin/bash process that is not bound to a terminal from a terminal? Hence, a shell process that shows up in the process tree as init -- bash. (Shells ...
0
votes
3answers
1k views

Is reparenting from the shell possible?

This question is closely related to How to "correctly" start an application from a shell but tries to tackle a more specific problem. How can I spawn an application from a shell and thereby ...
2
votes
0answers
628 views

Network connectivity issue between different hosts from a network namespace in one host

I have created two Ubuntu 12.04 VMs using VMWare Player with NAT network configuration. I am able to ping them from each other. After that, I created a network namespace in one of them and add a ...
5
votes
1answer
2k views

LXC container to use “virtual” interface from host (namespace semantics)

So according to the documentation on the Ubuntu LXC documentation the following statement can be found at the time of this writing: A NIC can only exist in one namespace at a time, so a physical ...
3
votes
1answer
379 views

Set environment inside `nsenter /bin/bash`

I'm entering a namespace with nsenter -m -u -i -n -p -t $PID /bin/bash. However, printenv inside this namespace doesn't have everything I need. I'd like to send these variables in, but I'd like to ...
10
votes
1answer
1k views

Reliable way to jail child processes using `nsenter:`

I know that Linux namespaces, among many other things, can be leveraged to handle restricting and jailing child processes securely without any chance of their being zombied and dumped on init. But I'm ...
1
vote
1answer
470 views

Linux PID namespaces

I have a question about number of PIDs a process has in context of Linux PID namespaces. Suppose: (NS = namespace) P1 (PID NS1) -> clone -> P2 (PID NS2) -> clone -> P3 (PID NS3) How many PIDs does ...
2
votes
1answer
743 views

How to move process from one namespace to other?

This question is similar to my question about how to list namespaces. So in addtition, I'd like to know some information about moving processes from one namespace to other? E.g. I have processes of ...
12
votes
2answers
4k views

how to find out namespace of a particular process?

I already asked a question about how to list all namespaces in Linux, but there wasn't any correct and exact answers, so I want to find out a method which can help me to find out the namespace of PID ...
6
votes
1answer
3k views

Creating VLANs between network namespaces

I want to implement the topology shown in the figure below using network namespaces (ns1 to ns4).                  ...
3
votes
2answers
2k views

In a UID namespace, can I setuid to an unmapped UID?

Suppose I'm user ID 1000. I run a program inside a UID namespace, mapping UID 0 inside the namespace to UID 1000 outside the namespace. The program then attempts to change its own UID to 50, which ...
4
votes
1answer
902 views

Is there a command to switch to into an existing namespace?

I am using multiple UTS namespaces, each of them has some servers constantly running. I can get the namespace IDs via readlink /proc/<pid>/ns/uts, now I would like to change into a given ...
9
votes
1answer
3k views

How to list namespaces in Linux?

Is there any method in Linux to list all namespaces on the running host? I need to check namespaces for particular processes (e.g. processes running in LXC-container and all other processes on the ...