Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of failure of docker SSH login to container

2025-04-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to solve the problem of docker SSH login container failure. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

SSH client logs out automatically after logging in

Debug part of the log with-v:

Ssh-v root@127.0.0.1-p 23

Port 23 maps a centos container for docker

Debug1: Next authentication method: publickeydebug1: Trying private key: / root/.ssh/identitydebug1: Trying private key: / root/.ssh/id_rsadebug1: Trying private key: / root/.ssh/id_dsadebug1: Next authentication method: passwordroot@127.0.0.1's password:debug1: Authentication succeeded (password). Debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.comdebug1: Entering interactive session.debug1: Sending environment.debug1: Sending env LANG = zh_CN.UTF -8Last login: Mon Jun 23 12:52:01 2014 from 172.17.42.1debug1: client_input_channel_req: channel 0 rtype exit-status reply 0debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0debug1: channel 0: free: client-session Nchannels 1Connection to 127.0.0.1 closed.Transferred: sent 1912, received 2128 bytes, in 0.0 secondsBytes per second: sent 55065.8, received 61286.6debug1: Exit status 254

Solution to this problem:

Change UsePAM yes in / etc/ssh/sshd_config to no

You can log in.

Or join in docker file

RUN sed-ri 's/UsePAM yes/#UsePAM yes/g' / etc/ssh/sshd_configRUN sed-ri' s/#UsePAM no/UsePAM no/g' / etc/ssh/sshd_config this is the end of the article on "how to solve the problem of docker SSH login failure in container". I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good. Please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report