I found a (lengthy) guide to doing this but it is for gksu which is gone. I have to imagine there’s an easy way. I am running Ubuntu. There is no specific use case, it is just a feature I miss from windows.

EDIT: I always expect a degree of hostility and talking-down from the desktop Linux community, but the number of people in this thread telling me I am using my own computer that I bought with my own money in a way they don’t prefer while ignoring my question is just absurd and frankly should be deeply embarrassing for all of us. I have strongly defended the desktop Linux community for decades, but this experience has left a sour taste in my mouth.

Thank you to the few of you who tried to assist without judgement or assumptions.

  • dinckel@lemmy.world
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    7 months ago

    Your polkit will always prompt you for a password. No need to complicate it. If it doesn’t, then it doesn’t need to be ran as root

      • billgamesh@lemmy.ml
        link
        fedilink
        arrow-up
        21
        ·
        7 months ago

        That comment meant anything that needs root will prompt for it WITHOUT you running as root. Running GUI apps as root directly won’t work well (1, it isn’t a good idea. 2, your user likely owns the X session)

      • Rustmilian@lemmy.world
        link
        fedilink
        English
        arrow-up
        12
        ·
        edit-2
        7 months ago

        Polkit (Policy Kit) is an authorization framework used in modern Linux distributions to manage access rights and privileges on the system. It allows unprivileged processes to communicate with privileged processes in a controlled and secure manner.
        pkexec a command used to execute commands with elevated privileges, leverages both PAM (Pluggable Authentication Modules) and Polkit to authenticate the user and authorize the requested action. PAM is a framework used in Linux systems to handle user authentication and authorization.
        Check out Polkit & PAM

      • Para_lyzed@lemmy.world
        link
        fedilink
        arrow-up
        9
        arrow-down
        1
        ·
        edit-2
        7 months ago

        While the other user explained what polkit is from a low level, I think it’s more practical to give you a high level explanation. Polkit is responsible for the dialog box that pops up when you try to open an app like GParted that requires root permissions (it edits partitions, a rootful task). What the user you replied to is saying is that you never want to run an app as root unless it prompts you for it (like with polkit prompts), or you know in great detail what you are doing. Running random things as root can break your system and the app you’re running. Most apps you will be using are not intended to be run as root under any circumstance, and at the very least will likely experience issues because of it (UI issues, data issues because the root home directory is not your home directory, configuration/setting changes, improper scaling, etc). Unless you know for a fact that something has to be run as root (like updating packages with your package manager) or you are specifically prompted when trying to do something, you absolutely do not want to be running things as root.

        Just to further explain, even if an app isn’t started as root, it can request that permission as needed. For instance, Nautilus allows you to navigate through the root directory, and will prompt you for a password through polkit if you are trying to access something your user does not have permission to read (of course assuming your user has sudo privileges, but that’s beside the point). Unlike Windows, there is no practical use for a “run as root” option, because apps have the ability to request root access when it is necessary, and only when it is necessary. In addition to that, polkit limits the root access that an app is given to the specific actions for which it is requested (so an app can’t use root privileges to run unauthorized commands). The exception to that is when you start dealing with the terminal, but that falls into the category of “you better know what you’re doing and why”.

        The short answer as to why this isn’t a thing in Linux is that the authentication and permission system functions nothing like Windows. In Linux, a “run as root” button is not a solution, it is a problem. The only reason that run as administrator exists in Windows is because sometimes the solution to a problem in Windows is to run an app as admin. That is not the case for Linux, and never will be.

        There are many ideological differences between Windows and Linux. You’ll find many discussions here about how it is often not a good idea to try to do something the “Windows way” on Linux, because those ideologies and the software principles are incompatible. Part of learning how wonderful Linux is involves unlearning all of the horrible habits and ideological differences that Microsoft forces onto Windows users. This is one of those things that has to be unlearned, because full root privilege is not something that a regular app should ever ask for or even want in Linux. Root privilege is provided on a case-by-case basis from polkit with GUI apps; only when needed.