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!
I discovered that this line in the Dockerfile works:
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_configHowever, 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.:
An easy fix is to either update the existing
sedcommand or add a secondsedcommand such as:RUN sed -i 's/#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_configIf the entry is not commented out, the secondary
sedcommand has no effect. Then I was able to successfully SSH once the file looked like this:Mostly posting here in case anyone else runs into this. I will submit a PR if I get a chance. Thanks!