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 namespace to do modifications there.
As far as I understand from man 2 setns
it should be possible to do this, by using the setns()
system call. There is even an example program which could do what I am looking for, but I was hoping that there is already some utility that most distributions include which can do the same job.
The unshare
command doesn't seem to work for me because it only creates new namespaces to launch processes in, but it doesn't allow me to specify an existing namespace.
unshare
and the utility is even in theutil-linux
package it might as well be that somebody has done it forsetns
– replay Dec 30 '13 at 15:23