Skip to content

root SSH login does not work in some scenarios #8

@brentwritescode

Description

@brentwritescode

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions