Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access Centos sshd on Docker

Tags:

docker

centos

I read an article that SSH Daemon Service. But I want to run on Centos6.4. So I setup from official centos image with almost same istruction. Then I connect to centos sshd server, but connection is closed immediately. Here is the message.

ssh root@localhost -p 49164
The authenticity of host '[localhost]:49164 ([127.0.0.1]:49164)' can't be established.
RSA key fingerprint is 88:71:89:e5:30:91:78:5c:bf:cb:88:c2:5b:81:1a:b5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:49164' (RSA) to the list of known hosts.
root@localhost's password: 
Connection to localhost closed.

Why I cannot connect centos sshd server?

like image 924
cpw Avatar asked Aug 11 '13 16:08

cpw


People also ask

Does CentOS 7 support Docker?

OS requirementsTo install Docker Engine, you need a maintained version of CentOS 7, CentOS 8 (stream), or CentOS 9 (stream). Archived versions aren't supported or tested. The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.

Is SSH enabled by default on CentOS?

SSH software packages are included on CentOS by default.


1 Answers

Had the same issue here, works fine if you turn off PAM in the sshd config.

Here are the relevant lines from our Dockerfile

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
like image 140
Vektah Avatar answered Oct 19 '22 17:10

Vektah