【问题标题】:IBM Container - su :cannot create child process: Resource temporarily unavailableIBM Container - su:无法创建子进程:资源暂时不可用
【发布时间】:2016-02-28 14:33:36
【问题描述】:

我正在尝试在部署在 IBM Containers/Bluemix 中的容器中“su”。 但它就这样失败了。

root@ubuntu142:/tmp# cf ic exec -it mysshd bash
[root@instance-001652d1 /]# adduser ubuntu
[root@instance-001652d1 /]# su - ubuntu
su: cannot create child process: Resource temporarily unavailable

这在我的本地 docker 环境中运行良好。 我还尝试在启动脚本中“su”(用户已定义),但它也失败并显示相同的消息(来自日志)。 (实际上,我正在尝试使用“su db2inst1”部署 DB2-Express-C..) IBM容器中是否有禁止“su”的限制?

提前致谢。

【问题讨论】:

    标签: docker containers ibm-cloud su


    【解决方案1】:

    我只在 Centos 7 容器实例中看到过这个问题(它适用于 Ubuntu)。

    解决方法如下:

    $ cf ic exec -it ads-centos bash
    [root@instance-00173f1f /]# adduser ubuntu
    [root@instance-00173f1f /]# su - ubuntu
    su: cannot create child process: Resource temporarily unavailable
    [root@instance-00173f1f /]# cd etc 
    [root@instance-00173f1f etc]# cd pam.d
    [root@instance-00173f1f pam.d]# vi su
    ** change all session variables to 'optional' and save changes **
    ** see how file should be below **
    [root@instance-00173f1f pam.d]# su - ubuntu
    [ubuntu@instance-00173f1f ~]$ id 
    uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu)
    [ubuntu@instance-00173f1f ~]$ 
    

    su 文件应该是这样的

    #%PAM-1.0
    auth            sufficient      pam_rootok.so
    # Uncomment the following line to implicitly trust users in the "wheel" group.
    #auth           sufficient      pam_wheel.so trust use_uid
    # Uncomment the following line to require a user to be in the "wheel" group.
    #auth           required        pam_wheel.so use_uid
    auth            substack        system-auth
    auth            include         postlogin
    account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
    account         include         system-auth
    password        include         system-auth
    session         optional        system-auth
    session         optional        postlogin
    session         optional        pam_xauth.so
    

    【讨论】:

    • 嗨,亚历克斯先生。谢谢你的回答。有用 ! (我在 ubuntu 主机上使用 CentOS7 docker 容器。所以你的建议正是我需要的。)我也对 SSH 失败症状感到恼火,但你的回答也解决了这个问题。谢谢!
    • 我很高兴它对你有用。你介意接受答案吗?
    • 感谢您的解决方案!现在,如果有人可以解释我在这里究竟改变了什么,有什么影响以及为什么首先会发生这个问题?例如。容器中用于 pam 身份验证的默认设置是否过于严格?通过工具设置/更改需求的规范方法是什么(我猜可以使用脚本 sed)。
    猜你喜欢
    • 1970-01-01
    • 2012-04-11
    • 2018-08-05
    • 2015-06-28
    • 1970-01-01
    • 1970-01-01
    • 2017-02-25
    • 2019-08-14
    • 1970-01-01
    相关资源
    最近更新 更多