这篇文章将为大家详细讲解有关如何解决docker SSH登录container失败的问题,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
SSH 客户端登陆以后自动退出
用-v 调试 部分日志:
ssh -v root@127.0.0.1 -p 23
23端口映射docker的一个centos容器
debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Trying private key: /root/.ssh/id_rsa debug1: Trying private key: /root/.ssh/id_dsa debug1: Next authentication method: password root@127.0.0.1's password: debug1: Authentication succeeded (password). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = zh_CN.UTF-8 Last login: Mon Jun 23 12:52:01 2014 from 172.17.42.1 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0 debug1: channel 0: free: client-session, nchannels 1 Connection to 127.0.0.1 closed. Transferred: sent 1912, received 2128 bytes, in 0.0 seconds Bytes per second: sent 55065.8, received 61286.6 debug1: Exit status 254
此问题 解决方案:
/etc/ssh/sshd_config 中的UsePAM yes 改成no
即可登录。
或者在docker file中加入
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
关于“如何解决docker SSH登录container失败的问题”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。