#359 Issue closed: SSH_ROOT_PASSWORD not enough

sanderu opened issue at 2014-01-24 12:05:

Setting SSH_ROOT_PASSWORD is not enough.

When trying to restore server I was unable to login due to sshd_config had:
PermitRootLogin no

I propose a change to /usr/share/rear/rescue/default/50_ssh.sh from:

        if [[ $SSH_ROOT_PASSWORD ]] ; then
                echo "root:$(echo $SSH_ROOT_PASSWORD | openssl passwd -1 -stdin):::::::" > $ROOTFS_DIR/etc/shadow
        fi

to:

        if [[ $SSH_ROOT_PASSWORD ]] ; then
                echo "root:$(echo $SSH_ROOT_PASSWORD | openssl passwd -1 -stdin):::::::" > $ROOTFS_DIR/etc/shadow
                sed -i "/PermitRootLogin/d" /etc/ssh/sshd_config
                sed -i "/PasswordAuthentication/d" /etc/ssh/sshd_config
                echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
                echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
        fi

This will ensure the possibility to use password for login.

gdha commented at 2014-01-24 12:08:

Ok good thinking! Could you please create a pull request which makes my
life so much easier!
Thank you for the good suggestion,
Gratien

On Fri, Jan 24, 2014 at 1:05 PM, sanderu notifications@github.com wrote:

Setting SSH_ROOT_PASSWORD is not enough.

When trying to restore server I was unable to login due to sshd_config had:
PermitRootLogin no

I propose a change to /usr/share/rear/rescue/default/50_ssh.sh from:

    if [[ $SSH_ROOT_PASSWORD ]] ; then
            echo "root:$(echo $SSH_ROOT_PASSWORD | openssl passwd -1 -stdin):::::::" > $ROOTFS_DIR/etc/shadow
    fi

to:

    if [[ $SSH_ROOT_PASSWORD ]] ; then
            echo "root:$(echo $SSH_ROOT_PASSWORD | openssl passwd -1 -stdin):::::::" > $ROOTFS_DIR/etc/shadow
            sed -i "/PermitRootLogin/d" /etc/ssh/sshd_config
            sed -i "/PasswordAuthentication/d" /etc/ssh/sshd_config
            echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
            echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
    fi

This will ensure the possibility to use password for login.


Reply to this email directly or view it on GitHubhttps://github.com/rear/rear/issues/359
.

sanderu commented at 2014-01-24 12:56:

Have now forked project and created pull request.


[Export of Github issue for rear/rear.]