mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge pull request #28677 from lkxed/20230215-0-Login-as-Root-in-Ubuntu-GUI
[手动选题][tech]: 20230215.0 ⭐️ Login as Root in Ubuntu GUI.md
This commit is contained in:
commit
a9d3a8a4c9
146
sources/tech/20230215.0 ⭐️ Login as Root in Ubuntu GUI.md
Normal file
146
sources/tech/20230215.0 ⭐️ Login as Root in Ubuntu GUI.md
Normal file
@ -0,0 +1,146 @@
|
||||
[#]: subject: "Login as Root in Ubuntu GUI"
|
||||
[#]: via: "https://itsfoss.com/ubuntu-login-root/"
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Login as Root in Ubuntu GUI
|
||||
======
|
||||
|
||||
By default, Ubuntu disables the root account. You must use the sudo command for any tasks requiring root privileges.
|
||||
|
||||
This is for your own security, of course. Using the system as root all the time is like running around with a sword in your hand. It increases the chances of messing up things.
|
||||
|
||||
Logging in as root is still common in the servers. On the desktop side, it's quite rare to log in as root. Even Kali Linux has changed it.
|
||||
|
||||
And yet, a few desktop users want to log in as root. This is not something advisable but surely doable.
|
||||
|
||||
in this guide, I will show you how to **log in as a root in your GNOME desktop** using Ubuntu.
|
||||
|
||||
### How to login as a root in the GNOME desktop
|
||||
|
||||
🚧
|
||||
|
||||
I won't advise login as root on the desktop. You have sudo mechanism for all your root needs. Do it only if you have a good enough reason. This tutorial is for demo purposes only. You have been cautioned.
|
||||
|
||||
#### Step 1: Enable root account
|
||||
|
||||
You want to log in as root. But the root account is disabled by default. The first step is to enable it.
|
||||
|
||||
Change the root account password that will eventually enable the root account for you:
|
||||
|
||||
```
|
||||
sudo passwd root
|
||||
```
|
||||
|
||||
![change the password of root account in ubuntu][1]
|
||||
|
||||
It goes without saying that you should not forget the root password.
|
||||
|
||||
#### Step 2: Change GDM configuration
|
||||
|
||||
🚧
|
||||
|
||||
This part of the tutorial is only valid for GNOME. Please
|
||||
|
||||
[check your desktop environment][2]
|
||||
|
||||
and ensure that it is GNOME.
|
||||
|
||||
Ubuntu uses GNOME by default and GNOME uses the GDM display manager.
|
||||
|
||||
To allow log in as root into GNOME, you need to make some changes in the GDM configuration file located at `/etc/gdm3/custom.conf`.
|
||||
|
||||
Make a backup of the config file:
|
||||
|
||||
```
|
||||
cp /etc/gdm3/custom.conf /etc/gdm3/custom.conf~
|
||||
```
|
||||
|
||||
In the worst case, if you somehow mess things up, the back up file can be used to replace the existing one from the TTY.
|
||||
|
||||
Now, open the GDM file with the following command:
|
||||
|
||||
```
|
||||
sudo nano /etc/gdm3/custom.conf
|
||||
```
|
||||
|
||||
And add the following line to allow the root login:
|
||||
|
||||
```
|
||||
AllowRoot=true
|
||||
```
|
||||
|
||||
![configure GDM on ubuntu][3]
|
||||
|
||||
Press Ctrl+X to exit Nano while saving it.
|
||||
|
||||
#### Step 3: Configure PAM authentication
|
||||
|
||||
Now, you will have to configure the PAM authentication daemon file, which can be opened by the following command:
|
||||
|
||||
```
|
||||
sudo nano /etc/pam.d/gdm-password
|
||||
```
|
||||
|
||||
In this file, you will have to comment out the following line with the `#` symbol that denies the root access in GUI:
|
||||
|
||||
```
|
||||
auth required pam_succeed_if.so user != root quiet_success
|
||||
```
|
||||
|
||||
![][4]
|
||||
|
||||
[Save changes and exit from the nano][5] text editor.
|
||||
|
||||
#### Step 4: Log in as root
|
||||
|
||||
Now, reboot your system:
|
||||
|
||||
```
|
||||
reboot
|
||||
```
|
||||
|
||||
At the login screen, select the `Not listed` option, enter `root` in username and enter the password that you configured at the beginning of this guide:
|
||||
|
||||
![Login as a root in ubuntu desktop][6]
|
||||
|
||||
Once you log in, it will notify you by saying, **"logged in as a privileged user":**
|
||||
|
||||
![logged in as a privileged user in Ubuntu][7]
|
||||
|
||||
That's it! Now, you are running your Ubuntu system as a root.
|
||||
|
||||
### Things you should know when running the system as a root user
|
||||
|
||||
There is a reason why Ubuntu disables a root account by default. Want to know why? Here you have it:
|
||||
|
||||
Root User in Ubuntu- Important Things You Should KnowHow do you become root user in Ubuntu? Either you run commands with root privilege like this: sudo any_command Or you switch user in Ubuntu to root user like this: sudo su In both cases, you’ll have to enter your own user account’s password. But there’s![][8]It's FOSSAbhishek Prakash![][9]
|
||||
|
||||
And again, it is not advisable to log in a s root in your desktop Linux system. Please follow the norms and stay away from such (mis) adventures.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/ubuntu-login-root/
|
||||
|
||||
作者:[Sagar Sharma][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sagar/
|
||||
[b]: https://github.com/lkxed/
|
||||
[1]: https://itsfoss.com/content/images/2023/01/change-the-password-of-root-account-in-ubuntu.png
|
||||
[2]: https://itsfoss.com/find-desktop-environment/
|
||||
[3]: https://itsfoss.com/content/images/2023/01/configure-GDM-on-ubuntu.png
|
||||
[4]: https://itsfoss.com/content/images/2023/01/configure-PAM-authentication-daemon-in-ubuntu.gif
|
||||
[5]: https://linuxhandbook.com/nano-save-exit/
|
||||
[6]: https://itsfoss.com/content/images/2023/01/Login-as-a-root-in-Ubuntu-desktop.png
|
||||
[7]: https://itsfoss.com/content/images/2023/01/logged-in-as-a-privileged-user-in-Ubuntu.png
|
||||
[8]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
|
||||
[9]: https://itsfoss.com/content/images/wordpress/2020/01/root_user_ubuntu.png
|
Loading…
Reference in New Issue
Block a user