sudo nautilus is OK but
sudo dolphin is not
Its bad practice, specifically disallowed … and theres not really any good reason to do so.
sudo nautilus is not ‘OK’ either…)
but it will be inconvenient when I am trying to copy files and paste into non-home folders via UI
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
kdesu … though those are somewhat better (maybe).
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
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.
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.
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.
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