Questions tagged [unshare]

6 questions
4
votes
0 answers

unshare network with loopback enabled

To run tests on the development build of my program I need to isolate it from the network. The build still needs access to loopback (127.0.0.1) though. I tried using unshare -c -n but the loopback interface is down by default. Using…
Kitsune
  • 117
  • 5
3
votes
0 answers

Can not access folder after chown with podman unshare

I have a rootless setup (podman is running in user space and the container I'm starting is also rootless. Now I wan't to mount a volume. To do so I'm using podman unshare chown but after executing this, I can not access the folder anymore The…
PascalTurbo
  • 2,189
  • 3
  • 24
  • 41
1
vote
0 answers

How to debug `podman unshare` commands / Podman permission issues?

I understand that podman unshare can be used to properly set the permissions on unprivileged containers. So podman unshare chown 1234:1234 -R /home/user/volume can be used to set the volume to the properly mapped ids. But I'm getting permission…
alexanderadam
  • 415
  • 6
  • 17
0
votes
0 answers

linux: setguid() in new user namespace

My initial task: start a bunch of processes in separate network namespace (with lo 127.0.0.1 interface only and no one listening any ports). So I use: unshare -n -r bash -c -x myscript.sh I need -r because of -n: you can't manage your "new network"…
pavelkolodin
  • 2,859
  • 3
  • 31
  • 74
0
votes
1 answer

file access after unshare mount namespace

I`ll be glad to get an explanation how unshar mount namespace works for the following code: unshare (mount_ns) int pid = fork() if (pid ==0) { makedir("myDir"); mount("path", "myDir", 0); int fd = open("myDir/myFile.txt", O_CREATE|O_RDWR); …
YAKOVM
  • 9,805
  • 31
  • 116
  • 217
0
votes
1 answer

Tmux session does not always open with expected mount bindings

I want to run unshare, mount a few directories, and run a tmux session in the new mount namespace. Here is my setup $ cat run #!/bin/bash mount --bind ~/a ~/b tmux $ unshare -r --mount ~/run When I run this command, I get dropped into the tmux…
Hufflet
  • 73
  • 5