Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH_ROOT_PASSWORD not enough #359

Closed
sanderu opened this issue Jan 24, 2014 · 2 comments
Closed

SSH_ROOT_PASSWORD not enough #359

sanderu opened this issue Jan 24, 2014 · 2 comments

Comments

@sanderu
Copy link

sanderu commented Jan 24, 2014

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
Copy link
Member

gdha commented Jan 24, 2014

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//issues/359
.

@sanderu
Copy link
Author

sanderu commented Jan 24, 2014

Have now forked project and created pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants