Become the root user and select a password
This guide will show you how to become the root user and create a password for the root account
This guide will show you how to become the root user and create a password for the root account
Last updated 24th March 2022
To perform certain administrative functions on your server (e.g. installing packages), you'll need to have a high level of user access. On Linux servers, this access is called "root".
This guide explains how to become the root user and create a password for the root account.
First, establish an SSH connection to your server with your default user.
At the command line, set a password for the root user (for security reasons, the password will not be shown as you type it):
~$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated
successfully
To update the installed software packages on your server, type the following command at the command line:
~$ sudo apt update && sudo apt upgrade -y
To update your server's operating system, type the following command at the command line:
~$ sudo yum update
To become the root user, type the following command at the command line:
~$ sudo su -
~#
Next, enter the root password.
First, set the root password.
Next, access the VNC console on the manager:
Click on the ...
button next to the corresponding instance and then click on Instance details
.
Switch to the tab VNC console
. At the command prompt, enter your login as root, then enter your password.
First, set the root password.
Next, enable root login and password authentication in your sshd_config file:
~$ sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
~$ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
Restart the SSH service:
~$ service sshd restart
Once done, you should be able to access your server with the root user and password set.
First, set the root password.
Next, enable root login and password authentication in your sshd_config file:
~$ sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
~$ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
Restart the SSH service:
~$ service sshd restart
In the Putty authentication agent (pageant key list), remove your private SSH key.
Once done, you should be able to access your server with the root user and password set.
Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community