Cannot SSH to rescue mode server - permission denied

New Linode is booted into Rescue mode, in LISH console I set passwd and start SSH. Connecting to linode using SSH to upload an image, I get permission denied. I cannot connect using SSH. How do I fix this???

6 Replies

Hi,
The SSH server may be set to stop root logins via a password. This seems to be the default on newer distributions. Edit the /etc/ssh/sshd_config file and look for a line this:
PermitRootLogin prohibit-password
Change it to this.
PermitRootLogin yes
Restart the ssh server if you have started it already, or start the SSH server after configuring this setting and changing your root password. Also, if the line is commented, uncomment the line. For example:
#PermitRootLogin yes
change to this:
PermitRootLogin yes

Blake

We recently updated our Rescue Mode environment, and our documentation is a bit behind on the new process. In order to successfully ssh into your server, you'll have to run the below commands while booted into Rescue Mode.

From your Lish console:

passwd

sed -i -e 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config

sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

service ssh start

From your Local Machine:

ssh-keygen -R $LinodeIP

Once these steps are completed, you should be able to ssh into your server.

That did the trick. However, since on Windows you cannot paste anything into the weblisp window from the clipboard, editing the sshd_config file was quicker. Not being able to copy or paste from the weblisp console is a limiting factor in these cases.

Hi team,

I have been trying to copy a linode server image down to my linux pc, using the "Copy a Disk Over SSH" guide.

I have get a permission denied message after the step 4:

The receiving system is prompted to enter the root password you created for the origin Linode in rescue mode. Enter this password now:

Warning: Permanently added '192.0.2.9' (RSA) to the list of known hosts.

root@192.0.2.9's password:

I went to edit the /etc/ssh/sshd_config file and found no entry for the

This was what I got from trying to connect with LISH Console vis SSH:

ssh -t myusername@lish-sydney1.linode.com DBCONNECTS_WP
The authenticity of host 'lish-sydney1.linode.com (2400:8907::f03c:92ff:fe6e:c2d5)' can't be established.
ECDSA key fingerprint is SHA256:whZwcrXeixljj6ZrrRYzLc6UguvkNqKmtXz+JrMSI9w.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'lish-sydney1.linode.com,2400:8907::f03c:92ff:fe6e:c2d5' (ECDSA) to the list of known hosts.
myusername@lish-sydney1.linode.com's password:
Permission denied, please try again.

I used the rescue password as directed with no luck.

I went to the /etc/ssh/sshd_config file and found no entry for
PermitRootLogin

So I added the entry and tried to save it. I cannot save it because it is in "Rescue Mode"?

Can someone please help me here?

Regards Bernard

Hi @bernardgbailey,

myusername@lish-sydney1.linode.com's password:
Permission denied, please try again.

That prompt has come from the Lish server, so you will want to make sure that “myusername” is the username you use to login to the Linode Manager, and type your Linode account password.

If you have configured Lish to require a public key for your account (or you login to Manager with a third party account, like Google), you’ll need to use your public key.

There are various Lish-related guides to help you, starting with this one.

Once you have logged in to Lish, you’ll be able to select your Linode to login to - which will then be the password you entered when you created the Linode.

Hey @bernardgbailey - in trying to recreate the issue you're experiencing I wasn't able to prompt the same errors/denials that you're seeing. I was able to copy my disk without issue, so in reading through the details you listed I wanted to clarify a few points:

Logging into your server in Rescue Mode:

  • Once booted into Rescue Mode, your server should remain in this mode for the duration of the task. Any changes you make to your files in Rescue Mode are temporary, and they will revert back to their original state once you exit out of Rescue Mode.
  • I would recommend connecting to Lish directly through Cloud Manager, rather than through your terminal.
  • Once connected through Lish, you are setting a temporary root password (passwd) and starting the SSH service on your Linode server - that's all.
  • You shouldn't have to do any additional work on the Linode server after completing this step.

Setting passwords in Rescue Mode:

  • The root password you set in Rescue Mode is completely different from the root password you set on the server through Cloud Manager, and the account password you use to log into your Cloud Manager.
  • If you set a Rescue Mode root password in Lish, and then try to connect through
    ssh -t myusername@lish-sydney1.linode.com DBCONNECTS_WP,
    the temporary password will not work as it wasn't set for myusername, it was set for root

Copying your disk over SSH:

  • When running the ssh command to copy your disk to your local machine, be sure to change out the placeholders of our commands (from the output you provided, I cannot tell if you did this):
ssh root@192.0.2.9 "dd if=/dev/sda " | dd of=/home/archive/linode.img
  • root@192.0.2.9
    should be replaced with
    root@$yourLinodeIPaddress
  • dd of=/home/archive/linode.img
    should be replaced with
    dd of=/filepath/on/your/Local/machine

Hopefully this helps break the logjam, but reach back out with more details if you continue to run into errors.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct