So far, I have only logged in as myself and have used sudo for various things when needed

Now I want to use the desktop text editor tool to modify some files in /var (for home assistant by the way)

The text editor says I don't have permission since I'm a low user. I could use chmod to give everyone RW permissions, but that sounds like bad practice...

So I figured why not log in to the Pi4 as root? what could go wrong

It lets me log in as 'root' when I provide the correct pw but all my UI is gone... I only see the trash can!

Where am I going wrong?

  • have used sudo for various things when needed ... so why is this time different?
    – jsotola
    Commented Mar 29, 2023 at 23:11
  • The caveats about logging in as root are two-fold: 1) That this enables you to do stupid bad things, 2) That malicious software run as root has more harm potential -- call this "devious bad things". On RpiOS, #1 is a bit meaningless since via sudo the normal pi user can do any stupid bad thing you could do as root. The same is somewhat true of #2, but the fact that you would normally only use sudo if you had to does incurr a similar kind of safety....
    – goldilocks
    Commented Mar 30, 2023 at 18:22
  • ....All that said, it is still not completely irrational to decide you want to log in as root. Your real problem here is that each user has a separate configuration for the GUI, and one was set-up by default for pi, but not for root, so if you really want to pursue this, that's the angle.
    – goldilocks
    Commented Mar 30, 2023 at 18:22

3 Answers 3


May I suggest you use sudo and a simple editor such as nano from a command shell.

sudo nano /var/file_to_edit

Don't change file permissions unless you know what you are doing.

  • ok. you've convinced me.. i will use nano Commented Mar 30, 2023 at 2:56

You can NOT login as root. This is normal for all Debian derived OS.
There is NO need to ever login as root (although it is possible to create a root login this is not considered a good idea).

You could not login to Desktop as root because there is no Desktop setup for root.

It is unclear WHY you think you need to be root or what you are trying to do. If you explain what you are trying to do alternatives are possible.

When modifying system files it is normal to do from the terminal (and make a copy of original FIRST).

The best practice is to use sudoedit path to file

  • thanks but i specifically said why i wanted to. i would like to use the standard gui text editor in raspian. i am trying to modify a configuration.yaml file in the /var tree which is where i installed my Home Assistant container. it seems silly that there is not an easy way to use the built in gui editor as root..but im not sure that is what you are saying. thx Commented Mar 29, 2023 at 22:21
  • 1
    You will not find any instructions to login to Desktop as root (which is considered a security risk) but it COULD be done by experienced user.
    – Milliways
    Commented Mar 29, 2023 at 22:56
  • 1
    If you REALLY want to use a GUI editor make a copy of the file to normal user, change permissions, edit the file then restore and reset permissions.
    – Milliways
    Commented Mar 29, 2023 at 22:58
  • i guess its worth familiarizing oneself with nano . its been a while since ive used a unix system (back in da day) . i assumed everything with linux was now gui based :) Commented Mar 30, 2023 at 2:58
  • Use sudoedit. This uses nano by default but has extra safeguards.
    – Milliways
    Commented Mar 30, 2023 at 4:59

The easiest way to become root is to login as your "regular" user, and then do this:

$ sudo -i su

That will give you the root user prompt: root@raspberrypi:/home/pi#, as a login shell. When you finish your rootly duties, you may simply type exit, and be returned to your user shell.

I would strongly counsel against using root privileges (however obtained) to chmod or chown files in /var (or any other directory) to avoid having to use sudo. But it's your system, as they say.

As Milliways has pointed out, by default there is no login for the root user in Raspberry Pi because they are a derivative of the Debian distro, and Debian does not support it out-of-the-box. There are some good reasons for this - mostly an effort to direct everyone to use sudo when they need root privileges because sudo provides accountability for use of root privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.