After connecting to the Virtual Machine via Gcore Customer Portal or SSH, enter the commands below in the terminal to run tasks with root user privileges.
Temporary root access
The following commands provide root access without enabling the root account permanently:
sudo — execute a single command as root.
sudo su — switch to a root shell for the current session.
sudo -i — start a login shell as root.
sudo -s — start a shell as root without a login environment.
Operating with root permissions allows for system-wide changes. Use these commands with caution — misuse can cause unintentional alterations or compromise system integrity.
Enable root user permanently
By default, cloud-init disables the root user on most Linux VMs. Modify the cloud-init configuration file to re-enable it.
- Run the following command to open the
cloud-init configuration:
sudo nano /etc/cloud/cloud.cfg
-
Change the line
'disable_root: true' to 'disable_root: false'.
-
Save the changes and close the file.
-
Update the
cloud-init configuration by running the following command: