2024年7月19日 星期五

Enable Root Login in Ubuntu Ubuntu 22.04

 

By default Ubuntu will not allow root login. You will have to either login to privileged user and then use the sudo command or you can use to sudo su to run as root.

Note: Its never a good idea to run as root.

  • The Ubuntu machine already as user ‘Student” which sudo privileges.

Step 1: Set password for the root.

$ sudo passwd

Set password for the root user.

Step 2: GDM configuration file need to be modified to allow root login. the file is located at /etc/gdm3/custom.conf. Add the line AllowRoot=true in the file.

Add AllowRoot=true to allow root login.

Step 3: Allow the root user to login via GUI.

previous steps allow the root user to login, but it does not allow the root user to login via GUI. the feature is disabled in the configuration file. Comment the line in the file /etc/pam.d/gdm-password that disabled root login via GUI and then we should be able to login as root via Login prompt.

Comment the line which disables the root gui feature.

Step 4: Finally restart the Ubuntu and should be able to login as root via GUI.

Step 5: Click on not listed.

Step 6: Enter the root as username and password which was set in set 1.

Enter root in username and password that was set earlier.

With great power comes great responsibility. Use the root users wisely.

 

資料來源:https://medium.com/@karthiked/enable-root-login-in-ubuntu-ubuntu-22-04-70521607bc7c

沒有留言: