Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With unshare or lxc-execute I can create environments with separate network/mount/whatever namespaces. But starting programs there from outside is not really straightforward. Usually network and sshd is used, I also use UNIX socket with socat executing shell to start new processes on it.

Is there already a program that allows to starting applications inside unshares easily? Client program is expected to connect to UNIX socket and send (SCM_RIGHTS) stdin/stdout/stderr to server. Server is expected to be started inside unshare and receive argv, environment and fds and start them.

Something like that:

# unshare -nm /usr/local/bin/dived /var/run/myunshare.socket
# # (Non-abstract unix sockets are preserved across "unshare -m")
# dive /var/run/myunshare.socket ping
connect: Network is unreachable
share|improve this question

migrated from May 19 '12 at 1:24

This question came from our site for computer enthusiasts and power users.

up vote 0 down vote accepted

Created program to do this myself:


# umask 0000
# # Create no-network namespace
# unshare -n -- dived /var/run/no_network.socket -d

$ dive /var/run/no_network.socket bash
$ # Now inside unshare. Shell should work well, can start X apps, etc.
$ ping
connect: Network is unreachable
$ # actually no network
$ id
$ uid=1000(vi) gid=1000(vi) groups=1000(vi),20(dialout),21(fax),...
$ # dived set up groups for us
$ exit
$ # "undove"

# killall dived
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.