Enable Root login in newly installed Ubuntu Server 16.04.2

Introduction

In a newly installed Ubuntu Server, the root user is commonly disabled for direct login by default. Administrative tasks such as installing applications, updating packages, or modifying system configurations require elevated privileges.

This guide explains how to set a password for the root user on a newly installed Ubuntu Server 16.04.2 and provides the commands that can be used to access a root shell.

Prerequisites

Before proceeding, ensure the following requirements are met:

  1. A newly installed Ubuntu Server 16.04.2 is available.
  2. A local user account has already been created during the Ubuntu installation.
  3. The local user has permission to use sudo.
  4. You have access to the server through SSH or the local console.

Implementation:

Consider this a fresh Ubuntu Server 16.04.2 installation. During the installation, a local username for example ABC, and a password have been created.

If you need to perform administrative tasks such as updating the server or installing an application, you can set a password for the root user using the following command:

sudo passwd root

You will be prompted to enter a new UNIX password for root. Enter the password twice.

You will get a message “Passwd: Password updated successfully”.Now the new password for Root is set.

Once the root password is set, we can perform apt-get upgrade or apt-get update.

Other ways to log in as Root are as follows.

  1. sudo -i
  2. su

Conclusion

Enabling the root user’s password on a newly installed Ubuntu Server allows administrators to perform system-level tasks using the root account. However, for security reasons, it is generally recommended to use sudo for administrative operations instead of enabling direct root SSH login.

Commands such as sudo -i provide a convenient way to obtain a root shell while maintaining better control over administrative access.

FQAs

1. How do I set a root password in Ubuntu Server 16.04.2?

You can set the root password using the following command:

sudo passwd root

2. How can I switch to the root user in Ubuntu?

You can switch to a root shell using either:

sudo -i

3. Is it safe to enable root login on Ubuntu Server?

It is generally safer to use sudo instead of allowing direct root login, especially over SSH. If root SSH login is enabled, use strong authentication and restrict SSH access to trusted users or networks.

https://pheonixsolutions.com/blog/change-ssh-default-port-disable-ssh-root-login/

Talk to our experts:

Looking for the right technology solution for your business? Our experts can help with web hosting, domain registration, DevOps and cloud, software development, web applications, mobile applications, and enterprise solutions. Get in touch with our team here.

admin

Writes about Web & Architecture at Pheonix Solutions.

Leave a Reply

Scroll to Top