• Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
  • Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
No Result
View All Result
Home Ubuntu

How to Get Root Access in Ubuntu 22.04

techdhee by techdhee
February 18, 2023
0 0
0
Get Root Access in Ubuntu 22.04

In this article, we are going to learn about how to get root access in Ubuntu 22.04. By default root user is disabled in Ubuntu. We can not log in as root. But we can log in into the terminal if we want.

Contents hide
1 What you’ll learn
2 What you’ll need
3 How To Get root Access:
3.1 Check login user
3.2 Login as root in the terminal
3.3 Check the root login or not?
3.4 Set the Ubuntu root password
3.5 Enable the root login
4 Login as root in Kali Linux
5 Video
6 Conclusion

What you’ll learn

  • How to set the root password
  • How to enable the root user
  • Some basic configuration

What you’ll need

  • Ubuntu Desktop
  • Sudo-privileged user account
  • Basic Linux command line knowledge

How To Get root Access:

In Ubuntu by default, we have to log in as non-root users, and then we have to set the root password by ourselves. The first time we don’t know the root password so we can not log in directly that is why we had to log in as a non-user which is created while we install Ubuntu.

Check login user

Now, first of all, you have to open the terminal and you can check the current login user with the help of whoami command.

$ whoami

Get Root Access in Ubuntu 22.04

Login as root in the terminal

Now we have to switch the user non-root to root so you have to type the command in the terminal as sudo -i and hit enter.

$ sudo -i

Check the root login or not?

Now you can check you are in the root you can identify with the symbol of # as well as you can type the same command whoami.

Get Root Access in Ubuntu 22.04

Set the Ubuntu root password

Now you have verified the current login user in the terminal is root so you have to type passwd command and hit enter, it is asking for a password so you have to enter the password and then verify the password, and that is it, you have set the root password using the terminal.

# passwd root

Get Root Access in Ubuntu 22.04

Enable the root login

We have to edit the following file to enable the root login. After editing the following file we can able to log in as root.

# nano /etc/pam.d/gdm-password

In this file we have to comment on the second line: auth required pam_succeed_if.so user != root quiet_success

#%PAM-1.0auth    requisite       pam_nologin.so#auth  required        pam_succeed_if.so user != root quiet_success@include common-authauth    optional        pam_gnome_keyring.so@include common-account# SELinux needs to be the first session rule. This ensures that any # lingering context has been cleared. Without this it is possible # that a module could execute code in the wrong domain.session [success=ok ignore=ignore module_unknown=ignore default=bad]        pam>session required        pam_loginuid.so# SELinux needs to intervene at login time to ensure that the process# starts in the proper default security context. Only sessions which are# intended to run in the user's context should be run after this.# pam_selinux.so changes the SELinux context of the used TTY and configures# SELinux in order to transition to the user context with the next execve()# call.session [success=ok ignore=ignore module_unknown=ignore default=bad]        pam>session optional        pam_keyinit.so force revokesession required        pam_limits.so

Get Root Access in Ubuntu 22.04

Login as root in Kali Linux

Now you can exit from the root user and close the terminal and log out from the non-root user and log in with the  root user with the help of a new password.

Get Root Access in Ubuntu 22.04

That’s it this is the way how you can change the root password and log in with the root user.

Video

You can watch the following video where I show step by step how you can get root access and how you can change the password.

Coming Soon

Conclusion

So this is the way how to enable root the user and log in as root on Ubuntu 22.04 LTS.  But login with root means you are the super user and you have many responsibilities.

If you have any questions, feel free to leave a comment.

Related Posts:

  • How to Create a File in Linux
  • Su Command in Linux
  • Nala – An Alternative To APT Package Manager
  • Install Nano Text Editor in Linux
  • Linux File Hierarchy Structure
  • Whoami command in Linux
ShareTweetSendShareSend
Previous Post

How to Install GIMP on Ubuntu 22.04 LTS

Next Post

How to Install Google Chrome on Ubuntu 22.04

techdhee

techdhee

Related Posts

Debian

How to install Tweak Tool on Ubuntu 22.04 LTS

March 3, 2023
Install Ngrok on Ubuntu 22.04 LTS
Debian

How to Install Ngrok on Ubuntu 22.04 LTS

March 2, 2023
Debian

How To Install the Apache2 on Ubuntu 22.04

March 1, 2023
Debian

Install Open VM Tools on Debian 11 Bullseye

February 26, 2023
Install VLC on Ubuntu 22.04
Ubuntu

How to Install VLC on Ubuntu 22.04 LTS

February 25, 2023
Install Nano Text Editor in Linux
Commands

How to Install Nano Text Editor in Linux

February 24, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

How-to-Check-Windows-10-is-Genuine-or-Not-Genuine

How to Check Windows 10 is Genuine or Not Genuine

August 6, 2023
How to Install Arch Linux

How to Install Arch Linux [Step by Step Guide]

August 6, 2023
Terminal Emulators for Linux

Top 6 Terminal Emulators for Linux

August 5, 2023
How to Install Tor Browser in Kali Linux 2023.1

How to Install Tor Browser in Kali Linux 2023.1

April 2, 2023

How to install Tweak Tool on Ubuntu 22.04 LTS

March 3, 2023
Install Ngrok on Ubuntu 22.04 LTS

How to Install Ngrok on Ubuntu 22.04 LTS

March 2, 2023

© 2024 tecdhee.com - Tech Tips, Tricks and Tutorials.

  • Home
  • About Us
  • Contact
  • Disclaimer
  • Privacy Policy
No Result
View All Result
  • About Us
  • Contact
  • Disclaimer
  • Home
  • Privacy Policy

© 2024 tecdhee.com - Linux Tips, Tricks and Tutorials.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In