-4

I was wondering if you could login as root, not through the terminal, but rather like you would if you made a normal user.

  • 1
    Note that Ubuntu disables the root account for security purposes. It works with sudo instead. You are free to enable the root account, but you do so only if you are aware of the security implications. – vanadium Dec 01 '22 at 07:58

1 Answers1

0

I have tried and it worked on Ubuntu 22.04.


Try this

#set root password
sudo passwd root

sudo vim /etc/pam.d/gdm-autologin ##Annotate this line #auth requied pam_succeed_if.so user != root quiet success

sudo vim /etc/pam.d/gdm-password ##Annotate this line #auth requied pam_succeed_if.so user != root quiet success

vim /root/.profile

  • mesg n 2> /dev/null || true
  • tty -s && mesg n || true

Then reboot


It's true that working directly under the root user is dangerous. It is more recommended to use sudo

  • 3
    Please also comment on the implications of such action for security. Ubuntu by default disables the root account for a reason. We want users to follow your advise only if they are well informed and can make their own evaluation of the security implications. – vanadium Dec 01 '22 at 08:00
  • @vanadium thanks for advising! – Jason Lee Dec 01 '22 at 08:17
  • @Jason Lee I tried doing what you did, but my computer got logged out, I had to fix it. I think you need to really fix your writing, because someone could have done something much worse. – ACTS 238 Dec 01 '22 at 12:35
  • @ACTS 238 Emmm do you fix the problem? This method works for me on ubuntu20.04, it just modified the permission to prevent you from logging into the desktop using root. If it is not working for you, I think this has no influence on logging in with regular users. – Jason Lee Dec 02 '22 at 03:03
  • I am using Ubuntu 22 – ACTS 238 Dec 02 '22 at 14:33
  • @ACTS 238 So you can log in now, do you need any more help? – Jason Lee Dec 02 '22 at 20:21
  • I cannot login to root, I had to undo what you did, I think you made a type error. Can you please fix it? I tried doing what you told me, but I could not login to my main account, or root. (I double checked my password, so that is out of the question.) – ACTS 238 Dec 02 '22 at 20:29
  • @ACTS 238 You means undo what I did makes you to be enable to login in your regular account? Sry for the trouble I caused you, I will try it on Ubuntu22.04 and edit the answer – Jason Lee Dec 03 '22 at 04:52