blob: 95a28a5d236a3fbce2bec287e672835289efa134 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
nsdo
====
`nsdo` (network namespace do) is a simple C program that runs a command
inside a given [Linux network namespace][1].
Effectively, it simplifies:
$ sudo ip netns exec myns sudo -u $USER myprogram
to
$ nsdo myns myprogram
Thanks to magic of the [setuid bit][2], it initially has root
privileges, which allows it to change its own network namespace,
`setuid()` to the user who ran the command, and then `exec()` the
requested command.
installation
------------
If you're on Arch, you can build [my AUR package][4].
Otherwise:
$ make
# make install
To change the default installation directory of `/usr/local`, set
`PREFIX` to something else when you call `make install`.
openvpn example
---------------
I wrote this program because I run some applications under a VPN (e.g.,
clients for peer-to-peer protocols) and leave others untouched (like a
game client).
For more details, see `openvpn-example.md` ([cgit][5], [github][6]).
license
-------
[MIT/X11][3].
[1]: https://lwn.net/Articles/580893/
[2]: https://en.wikipedia.org/wiki/Setuid
[3]: https://github.com/ausbin/nsdo/blob/master/LICENSE
[4]: https://aur.archlinux.org/packages/nsdo-git/
[5]: https://code.austinjadams.com/nsdo/plain/openvpn-example.md
[6]: https://github.com/ausbin/nsdo/blob/master/openvpn-example.md
manpage
-------
|