docker-clion-dev icon indicating copy to clipboard operation
docker-clion-dev copied to clipboard

root SSH login does not work in some scenarios

Open brentwritescode opened this issue 4 years ago • 0 comments

I discovered that this line in the Dockerfile works:

RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

However, for me the entry in the /etc/ssh/sshd_config file itself is still commented out (not sure if it's always a problem) and as a result still gets "access denied" when trying to SSH as root. i.e.:

$ grep -i "PermitRootLogin yes" /etc/ssh/sshd_config
#PermitRootLogin yes

An easy fix is to either update the existing sed command or add a second sed command such as:

RUN sed -i 's/#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_config

If the entry is not commented out, the secondary sed command has no effect. Then I was able to successfully SSH once the file looked like this:

$ grep -i "PermitRootLogin yes" /etc/ssh/sshd_config
PermitRootLogin yes

Mostly posting here in case anyone else runs into this. I will submit a PR if I get a chance. Thanks!

brentwritescode avatar Feb 12 '20 17:02 brentwritescode