centos - 内核3.10的linux中执行unshare --user /bin/bash报错Invalid argument,是什么原因?

查看:427
本文介绍了centos - 内核3.10的linux中执行unshare --user /bin/bash报错Invalid argument,是什么原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

在内核3.10的linux中执行

unshare --user /bin/bash

结果,报错:unshare: unshare failed: Invalid argument。

1、内核3.10的Linux是支持User Namespace的。
2、在查看unshare帮助文档时,里面也提供了如下的示例:

$ unshare --map-root-user --user sh -c whoami

但是执行之后,同样报上面的错误。
3、在执行代码ls -l /proc/$$/ns后,显示如下,没有user,但是查阅相关资料,说是只要内核支持就能使用。

参考资料:Linux Namespace系列(01):Namespace概述

各位大神有没有遇到过这个问题,帮忙看一下~

解决方案

在使用centos或者redhat吗, user namespace在redhat 7里似乎还属于技术预览特性

参考这里

启用该内核特性,可以试试:

    grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
    reboot

这篇关于centos - 内核3.10的linux中执行unshare --user /bin/bash报错Invalid argument,是什么原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆