When will Dolphin be opened with sudo?

sudo nautilus is OK but sudo dolphin is not

1 Like

Never.
Its bad practice, specifically disallowed … and theres not really any good reason to do so.
(no … sudo nautilus is not ‘OK’ either…)

1 Like

but it will be inconvenient when I am trying to copy files and paste into non-home folders via UI

1 Like

In what scenarios do you actually need to do that?
(and further … are they things that someone who cannot do without drag-drop-gui should be doing?)

But thats all philosophy to me …

The fact is that if you sudo %GUI-APP you have given root privileges to all of X
( the thing that draws all of the things on your screen )
How bad is this?
No one knows … its so insanely intrinsically broken from a security standpoint … it would be impossible to index, and no one cares to. It is simply the wrong way to do things.

This even applies to deprecated things like gksudo and kdesu … though those are somewhat better (maybe).

2 Likes

As @cscs said, it’s not okay. However, for Nautilus you can install the nautilus-admin extension that uses Polkit to open it with elevated privileges. I’m not sure of an equivalent for Dolphin.

You can make use of Root Actions for menu entries

image

disable the non working ones and you can Copy, Move/Rename, Delete files and folders that way. The dialog is not ideal, but if you really need it, is possible that way.

1 Like

Bah. Thats still broken and shouldnt be used.

If you must do something like that … it should probably look more like this:

Yes, but the menus i show in my screenshot work. I just disable those that don’t work, so there is no temptation to click on them. I don’t use them actually because i don’t need to copy things as root, and if i do, i use terminal. :slight_smile:
Was just for the sake of OP.

The ones that work ‘work’ in the way that they havent been updated for years and still implement kdesu in the naturally broken fashion already discussed… ‘working around’ the roadblocks that kde/dolphin devs implemented on purpose.
The example I give above at least uses polkit instead.
(and makes sure you know its the ‘danger dolphin’ and such)

Whether or not we want such a hacky ‘polkit dolphin’ or just better ‘sudo cp’ actions … the referenced package should be revised or retired.

If you need use filebrowser gui as root ,you can use krusader but i recommend use mc in konsole instead.

2 Likes

As mentioned this is not really desirable but you can do the below to create a separate dolphin (root) menu item, to use when it is truly needed (as powerfull as the CLI is somethings are just easier in the GUI).

To get around it you can create a copy of the dolphin.desktop file (should be located at: /usr/share/applications/org.kde.dolphin.desktop) in /home/user/.local/share/applications.

Rename the copy to something like “dolphin (root).desktop”. Edit this new .desktop file and set the exec option to: “Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch dolphin %u”.

To add it to the service menu you can copy this new .desktop file to /home/user/.local/share/kservices5/ServiceMenus (If the path does not exist simply create it).

You more or less have to get accustomed to using the command line for copying with root privileges. There is proper polkit support for Dolphin / KIO as a whole in the works but progress on it has been very slow, despite it being almost finished. You can have a look at it here: ⚙ D7563 Add privilegeExecution field to file protocol description

1 Like

I just tried this in a VM, it worked perfectly. I was able to get the expected behavior of using dolphin normally and getting dolphin to escalate from the root actions menu. It survived reboots and everything.

When I tried this on my laptop installed from the same image as the vm, it’s backwards. When I open a folder on the desktop it asks for root password and gives me a root file manager. The root actions menu however, doesn’t work. It’s possible I did something wrong, so I am reflashing to try again.

If that doesn’t work out, anyone have any suggestions?

I toyed with the idea of other file browsers, but other than konqueror they seem to break the trash widgets. I like everything about plasma except this.

I find this to be highly unusable, which is an unfortunate thing.

Edit:

I got it. I needed to add that line to a totally different file, 10-rootactionsfolders.desktop, and it works. Nowhere else is it needed.