Created
June 1, 2013 20:04
-
-
Save gasi/5691565 to your computer and use it in GitHub Desktop.
Setting up an SSH server on @dotcloud docker CentOS image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install OpenSSH server and SSH client | |
yum install -y openssh-server | |
yum install -y openssh-clients | |
# Install passwd | |
yum install -y passwd | |
# Set root password | |
passwd | |
# TODO: Enter new root password | |
# TODO: Repeat new root password | |
# Test ssh | |
ssh root@localhost | |
# Enter root password when prompted | |
# ERROR: Connection to localhost closed. | |
# ERROR: Exit status 254 |
@pungoyal Thank you! It helped me too!
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
Thanks for the tip on UsePAM
. Works great! Been looking for a solution for like an hour. 👍
Still, I wonder why it does that.
I guess this PAM setting is not needed since docker 1.0.0
PAM setting is not needed +1
PAM setting is still needed (Docker 1.4, phusion/baseimage:latest). -1
For automating the passwd part
( sleep .1 ; printf "%s\n" "password" "password" ) | passwd
Then password could be easily editable through other means using Jinja during deployment or something...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved it for us too. Thanks.
You can check if it's a PAM issue by starting a container and overriding the CMD to run sshd in the foreground...