在 Linux 内核中启用 UTS 命名空间

Dev*_*son 3 kernel development configuration linux-kernel

配置Linux内核时,启用UTS命名空间有哪些优缺点?如果 UTS 命名空间被禁用,新系统会受到损害吗?

slm*_*slm 5

UTS 命名空间是每个进程的命名空间,允许一个进程为不同的资源拥有不同的命名空间。例如,一个进程可能有一组命名空间,用于以下内容:

  • 挂载点
  • PID号
  • 网络堆栈状态
  • IPC——进程间通信

注意:在 Linux 内核3.8+ 版本之前名称空间的使用仅限于 root

取消分享

您可以使用该命令unshare将父进程的命名空间与子进程解除关联。

$ unshare --help
Usage: unshare [options] <program> [args...]
Run program with some namespaces unshared from parent

  -h, --help        usage information (this)
  -m, --mount       unshare mounts namespace
  -u, --uts         unshare UTS namespace (hostname etc)
  -i, --ipc         unshare System V IPC namespace
  -n, --net         unshare network namespace

For more information see unshare(1).
Run Code Online (Sandbox Code Playgroud)

编译器选项

支持 uts 命名空间。这允许容器,即 vservers,使用 uts 命名空间为不同的服务器提供不同的 uts 信息。如果不确定,请说 N。