Ubuntu Linux: How to Login as root User


tl;dr: root user is disabled by default. Make use of sudo to perform administrative tasks with elevated privileges.

If you are on a Ubuntu Linux distribution system and want to login as root user, then the first thing you should know is "the root user is disabled by default in Ubuntu for security reason" - Read the official page: https://help.ubuntu.com/community/RootSudo

So the su - command will not work.

But, If you are a part of the sudoer group (sudo) then you can make use of the sudo command to perform administrative tasks with elevated privileges.


Examples:
# sudo apt install python3

[sudo] password for mike: 
Reading package lists... Done
...
# sudo nano /etc/nginx/nginx.conf
Ubuntu Linux Login as root user

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap