Will resetting the root password allow me to access SSH as root?

Linode Staff

Hello,

We are planning on resetting the root password and we have a couple of questions about the process -

Once we change the root password, will this enable us to SSH to the server as the root user?

Are there any consequences that we should be aware of? For instance are there any services running that depend on the current root password?

Thanks so much.

1 Reply

Hello,

These are great questions! You should always consider the impact that performing one action on your server could have on other parts of the system. That being said, resetting your root password should have no effect on any other part of the system, aside from having to enter a different password when logging in as root. Any processes that require root privileges will continue to function as though the password had never changed at all. You can find instructions to reset your root password here.

As for gaining root access via SSH - this depends on some other factors, namely the configuration of /etc/ssh/sshd_config. Inside of this file, there are 2 options that will need to be set correctly in order to make root password authentication over SSH a possibility. Verify that the following entries exist:

PasswordAuthentication no
PermitRootLogin no

As long as these entries exist and look like this, then you will be able to login as root via SSH.

All of this being said, I think it is extremely important to take a moment to discuss the security implications of this configuration. As a rule, it is not recommended to access the root account via SSH, nor is it recommended to have password authentication enabled for SSH at all. The most secure way to access your server over SSH is using Public Key Authentication, with root access disabled as per the instructions in our guide on Securing Your Server. Whenever you need to run something with the root user's privileges, you can either escalate privileges on a command-at-a-time basis using the 'sudo' command, or you can launch a root shell using 'su'. The 'sudo' and 'su' commands use the following syntax:

sudo <command>
su -

If you need to access your Linode directly as root for any reason (you shouldn't if you're using 'su -', since this launches a shell as the root user and is equivalent to logging in directly as root) then you can use our LISH Console and login as root via that interface.

Regards,
Tom D.
Linode Support Team

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