Linux Namespaces

Ed King
Ed King
Dec 10, 2016 · 3 min read

👟 Kicking the tyres

$ unshare -h

unshare [options] <program> [<argument>...]

Run a program with some namespaces unshared from the parent.

-m, --mount[=<file>] unshare mounts namespace
-u, --uts[=<file>] unshare UTS namespace (hostname etc)
$ sudo su                   # become root user
$ hostname # check current hostname
$ unshare -u /bin/sh # create a shell in new UTS namespace
$ hostname my-new-hostname # set hostname
$ hostname # confirm new hostname
$ exit # exit new UTS namespace
$ hostname # confirm original hostname unchanged

👑 7 namespaces to rule them all

📺 On the next …

Ed King

Written by

Ed King

A Software Engineer currently working with Cloud Foundry and Kubernetes.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade