0

I am running Debian 12 with KDE Plasma desktop 5.27 and my problem is that every time I open an app it won't allow me to do things as sudo or permissions are not set correctly.

For example, when I open Dolphin file manager I can read, write and modify files in my home folder but if I go down to the root folders I can't write or modify files. I have to open a terminal create a file in root by using the sudo command. I want to be able to use Dolphin to do these tasks though.

Another example is KDE partition manager. When I open it I can see all my devices but if I try to format my USB drive I don't really get the option to do anything. All options are greyed out and there is a lock next to the partition.

Is there anyway that I can just open apps as sudo and allow them to have sudo access so that I don't have to go to the terminal to complete these tasks?

6
  • 1
    Your request breaks Linux's security model. There is a reason that a standard user can't do the things you mention. And @music2myear .. they mean the dolphin file manager. Commented Dec 26, 2023 at 17:35
  • 1
    I think you should not assume the true issue is the same simply because root "solves" all the issues. Approach each of your issues individually and solve that problem using the method appropriate to it. For THIS question, take a few steps back, choose one specific problem, do some work solving it, and bring only that question here. Commented Dec 26, 2023 at 17:35
  • 2
    @SeñorCMasMas OP didn't specify. I did a quick web search and the emulator came up first. The base point remains, and we agree on that I think. Commented Dec 26, 2023 at 17:36
  • 1
    Some apps, like FeatherPad in Debian 12, only ask for root/authentication when trying to save (root) files. A "Saving as root. Waiting for Authentication..." message and an "Authenticate... needed to run /usr/bin/cp as the super user" password popup appear (I think using pkexec / polkit framework). And Thunar (file manager) can set an "Open root Thunar here", again using pkexec thunar
    – Xen2050
    Commented Dec 26, 2023 at 18:56
  • 1
    Thank you @music2myear, I just want to clarify that I am indeed talking about the Dolphin file manager. I should have been more specific and I have edited my question.
    – stucklucky
    Commented Dec 26, 2023 at 18:57

3 Answers 3

3

For example, when I open Dolphin I can read, write and modify files in my home folder but if I go down to the root folders I can't write or modify files. I have to open a terminal create a file in root by using the sudo command. I want to be able to use Dolphin to do these tasks though.

Use KIO's "access as admin" feature by opening admin:/. (This often comes as a separate kio-admin package; it should work across all "KDE native" apps. The same kind of functionality also exists in GNOME (GTK) apps, without any separate installation.)

Another example is KDE partition manager. When I open it I can see all my devices but if I try to format my USB I don't really get the option to do anything. All options are greyed out and there is a lock next to the partition

That particular lock means the partition is mounted; it has nothing to do with permissions.

1

Don't make permanent changes to always open an application as superuser, the root user, because, as others have stated, it defeats the inherent security of Linux.

Instead, where needed, open the application using sudo. It may seem like an extra step, but that is well worth the trouble to avoid having antimalware continuously running in the background, as is needed by another popular operating system.

For example, to run gedit as super, open Terminal and enter sudo gedit. Close that instance of gedit when done. "Editing files as the root user is potentially dangerous, and may break your system in bad ways."

The Dolphin file manager has a built-in check to prevent the unwary from causing harm. That said, I admit to this risky practice (and make disk images to prepare for a disaster I might create). PCManFM is another file manager that does not kvetch when launched sudo... but it may break some functionality. Caveat operator!

As for being unable to make changes to a drive, if it is mounted, some operations are verboten. That would be like trying to change the distributor cap on a car while driving it. First unmount, then modify.

1
  • The other popular operating system has measures that allow it to mix elevated apps and non-elevated ones (namely, integrity levels) as part of UAC; X11 has nothing like that. It's amazing we haven't had daily incidents of bad apps injecting "sudo..." keystrokes into Xterm, and so on. Commented Dec 26, 2023 at 18:38
0

The post How to run programs as root user without using Terminal has the following answer by Radu Rădeanu that can help with your problem:

If you want to run programs without using Terminal, I can deduce that you mean only GUI programs. And each one from all these GUI applications have in general an .desktop file located in /usr/share/applications/ or in your user directory ~/.local/share/applications. So to start a program as root you must to edit or better duplicate its associated .desktop file.

Let's take for example Gedit, the default GUI editor in Ubuntu. Its .desktop file is /usr/share/applications/gedit.desktop and has the following content:

[Desktop Entry]
Name=gedit
GenericName=Text Editor
Comment=Edit text files
Exec=gedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;
X-GNOME-DocPath=gedit/gedit.xml
X-GNOME-FullName=Text Editor
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gedit
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.10.4
X-GNOME-Bugzilla-ExtraInfoScript=/usr/share/gedit/gedit-bugreport
Actions=Window;Document;
Keywords=Text;Editor;Plaintext;Write;
X-Ubuntu-Gettext-Domain=gedit

[Desktop Action Window]
Name=Open a New Window
Exec=gedit --new-window
OnlyShowIn=Unity;

[Desktop Action Document]
Name=Open a New Document
Exec=gedit --new-document
OnlyShowIn=Unity;

Now create a duplicate of this file as follow:

sudo cp /usr/share/applications/gedit.desktop /usr/share/applications/root_gedit.desktop

and make the following changes:

[Desktop Entry]  
Name=gedit as root  
GenericName=Text Editor as root  
Comment=Edit text files  
Exec=gksudo gedit %U  
Terminal=false  
Type=Application  
StartupNotify=true  
MimeType=text/plain;
Icon=accessories-text-editor  
Categories=GNOME;GTK;Utility;TextEditor;  
X-GNOME-DocPath=gedit/gedit.xml  
X-GNOME-FullName=Text Editor  
X-GNOME-Bugzilla-Bugzilla=GNOME  
X-GNOME-Bugzilla-Product=gedit  
X-GNOME-Bugzilla-Component=general  
X-GNOME-Bugzilla-Version=3.10.4  
X-GNOME-Bugzilla-ExtraInfoScript=/usr/share/gedit/gedit-bugreport  
Actions=Window;Document;  
Keywords=Text;Editor;Plaintext;Write;  
X-Ubuntu-Gettext-Domain=gedit

[Desktop Action Window]  
Name=Open a New Window  
Exec=gksudo gedit --new-window  
OnlyShowIn=Unity;

[Desktop Action Document]  
Name=Open a New Document  
Exec=gksudo gedit --new-document  
OnlyShowIn=Unity;

After this, when you will search for gedit in the Dash you will see two instances of gedit: one named Text Editor and one Text Editor as root. You should open that one named Text Editor as root if you want to run gedit as root.

Note: gksudo must to be installed in order to use it. If you don't have installed, you can install it from terminal using:

sudo apt-get install gksudo
1
  • gksudo doesn't appear to be a package in Debian anymore packages.debian.org/… pkexec is apparently popular now. Or sudo -A [program] if /etc/sudo.conf has a line like "Path askpass /usr/bin/ssh-askpass"
    – Xen2050
    Commented Dec 26, 2023 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .