How to login with a password as root on your Scaleway cloud instance?

The final goal of this tutorial is to allow you to login to your Scaleway cloud instance with a password that you will define, and without any SSH key.

Please note that this login method isn't recommended for security reasons. If you still want use it, please be sure that you've installed other security softwares like Fail2ban on your Linux machine.

Prerequisite:
-have a Scaleway cloud instance configured with an SSH key
-have an SSH client (Terminal for MacOS/Linux distros, or Putty for Windows)

In order to secure your infrastructure, Scaleway uses SSH key method by default for all of their cloud instances. So you will not receive a root password by email, as many VPS/cloud providers do. Otherwise, this is still possible to use a custom password by default for your root user.

Step 1: Login with your root user by SSH key

In order to get access to your Linux system (Debian, CentOS, Ubuntu, or other), you will have to log to your Scaleway instance with your SSH key.

If you don't know how to do this, you can follow my documentation available here.

If you're on MacOS, or Unix-based system, you can use the following command:

ssh root@YourInstanceIP

Congratulations! Now, you're logged on your Scaleway cloud instance.

Step 2: Authorize root login with a passsword

Now, we must authorize root login with a password. On all of Unix-based systems, there is only one file where you will be able to authorize it. This file is called "sshd_config". It can be find at the following path:

In order to modify it, please open it with your favorite text editor, as you used to do, and in this case, I will use Nano. Then, type enter.

nano /etc/ssh/sshd_config

Once you've on this file, you will have to add the following line:

PermitRootLogin Yes

You can add this line, where you want, but I advise you to add this line, just above the "Port 22" line, as following:

Once you've done this modification, please press CTRL+X, Y and click on enter.

Congratulations, we've authorized root login on our SSH service (including SFTP).

Step 3: Define a root password

As I've said previously, Scaleway doesn't provide any root password by default. Now, we have to set one. To do it, type the following command, and press enter.

passwd

Now, your operating system will ask you to define a new password. Don't worry, this input is hidden, and you will not see any character displayed on your screen. Once it's done, press enter, and retype again your password. Once it's done, you will have a message which confirms you that your password was updated successfully.

Step 4: Restart our SSH service

Now, we've set a root password, we've authorized the root login with it, but in order to take effect, you will have to restart your SSH service, with the following command:

systemctl restart ssh

Congratulations, now you can log in to your instance with your customized password that you've set previously.

Extra step: Try to connect to your instance with your password

In order to verify if it's working, now you can try to log in to your instance.
Auth system will ask you your passphrase, just type enter, and now, enter your password.


Permalink: https://tomjorge.me/how-to-login-with-a-password-as-root-on-your-scaleway-cloud-instance/