Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kdesu dolphin as root not possible [SOLVED-again]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13498

PostPosted: Tue Jul 24, 2018 12:50 am    Post subject: Reply with quote

What's wrong with /bin/su - to get root and ${EDITOR:-/usr/bin/vim} /path/to/config/file to edit the file? You don't need a working root Dolphin, or even a working GUI of any sort, for either of those steps.
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Tue Jul 24, 2018 2:28 am    Post subject: Reply with quote

Hu wrote:
What's wrong with /bin/su - to get root and ${EDITOR:-/usr/bin/vim} /path/to/config/file to edit the file? You don't need a working root Dolphin, or even a working GUI of any sort, for either of those steps.


Because that is the way I prefer to do it because it is easier for me. One could make the argument that one doesn't need a GUI at all, for anything, if one wants to make it harder on themselves. One could even argue that no one even needs a computer at all. Right? That's not the question tho is it? The question is, how do I make dolphin work as root like it did before the update?

I might add, I use dolphin as root for other things as well. Either way, I need it to work. If I needed a GUI to hold my hand and protect me from myself, I'd use windoze. lol
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3210
Location: Gainesville, Florida

PostPosted: Tue Jul 24, 2018 7:49 pm    Post subject: Reply with quote

dalek,
I tend to agree with your above comments, and FWIW, here's what works for me:
1. I have
Code:
alias kdol="export XDG_CURRENT_DESKTOP=kde && dolphin"
in /root/.bashrc

2. In my /home/wrc/.bashrc file I have
Code:
alias su="su -"
as I su very, very often, and just dislike typing su - every time. :roll:

3. I open konsole, su to root, and type kdol, and I get my beloved Dolphin root window, with normal icons.

kdol's output is:
Code:
gentoo-main ~ # kdol
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
qt.accessibility.core: Cannot create accessible child interface for object:  PlacesView(0xc79d00)  index:  12
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
and other child processes out of the root dolphin are of course all root, but produce no other output in the konsole kdol terminal.

Previously, If I left out the export and/or the && dolphin in my alias as mentioned in other posts, the kdol terminal produces extended detailed output for every subsequent window or file you work with, which I did not really want.

If the above doesn't work on your system, I'm currently at a loss as to explain why not.
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.29-r2, gcc-8.3.0-r1 kernel-5.0.7-gentoo USE=experimental
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Tue Jul 24, 2018 8:09 pm    Post subject: Reply with quote

The way I have been doing it is this. Way back, even before the patches in this thread were needed and as far back as KDE3, I had a menu entry. It is a menu entry just like Firefox, Kpatience and any other software I use. The difference was, it was set to run as root in the advanced section. When I click the menu item, it pops up a window asking for the root password and then it would run dolphin as root. From there, I could click a text file, package.use for example, and it would open with Kwrite as root. I might add, before Dolphin came along, I did the same thing with Konqueror. I actually prefer it but dolphin does work. I think Konqueror is dying or dead.

I tried to modify the menu entry to work the same as what is posted recently in this thread but I get the error I posted earlier. If running dolphin as root is going to be so difficult, maybe I need to set emerge to run as a user, everything, config files and all. Just set all the permissions to my user and its group and run it that way. It would defeat every bit of security BUT at least I could do my updates, edit config files and such without having to jump through a bunch of silly hoops that really do little if any good when it comes to Gentoo. I can see the logic with other distros like Kubuntu, Fedora etc but for Gentoo where one must get under the hood and tweak things, one needs root to be easily accessible. Other than emerge, I rarely run anything else from the command line. On occasion I have to do some work with LVM for my hard drives but that is rare.

If I ever find a solution, I'll post it here. I'm sure some developer well disable that to soon enough tho. Maybe I need to try those GUI portage tools if they are still around. I didn't like them much before but maybe they will at least work without jumping around so much.
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3210
Location: Gainesville, Florida

PostPosted: Tue Jul 24, 2018 9:14 pm    Post subject: Reply with quote

I also recall the very early kde days and using konqueror as my file manager. Did we use kdesu then-I forget? Just looked at today's konqueror and it does have a file manager mode, like before.

I just tried to figure out how it now works- says it uses a "dolphin component", and I seem to be missing some related kde lib as i can't get it into file manager mode.
Little quote from current konqueror handbook:
Quote:
Konqueror the File Manager
View Modes
In File Manager mode, Konqueror lists which files and subfolders are contained within a given folder and can provide you with some information about them. The “path” of the current folder is shown in the Location Toolbar. The way that Konqueror displays the files and folders depends mainly on your choice of view mode which can be selected from the View → View Mode sub menu. The view modes Konqueror provides are outlined below.
Note
In File Manager mode, Konqueror uses an embedded Dolphin component.

Anyway,back to dolphin. What happens if you open a konsole terminal, su to root, and then try running:
Code:
export XDG_CURRENT_DESKTOP=kde && dolphin
You still don't get a root dolphin window popping up, with kde icons?

Once I set this up, all I now need to do in a root terminal is type my "kdol" alias, and my root dolphin opens,

No more complex than in years before using kdesu, or with the now defunct patches where I just typed the kdol alias in a user konsole terminal, and the little window popped up for the root password. The only difference is I'm now typing a root password first in the terminal, then I type kdol, and then the dolphin root window pops up.

@Nsane457,
If you're following this, how about a nice little epatch to get rid of the annoying Running Dolphin as root can be dangerous. Please be careful. top of window message?

Might try it myself, if I can find the correct dolphin file and adapt your dolphin patch, but I'm not sure I can manage it. :roll:
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.29-r2, gcc-8.3.0-r1 kernel-5.0.7-gentoo USE=experimental


Last edited by wrc1944 on Wed Jul 25, 2018 3:34 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13498

PostPosted: Wed Jul 25, 2018 1:51 am    Post subject: Reply with quote

dalek wrote:
Hu wrote:
What's wrong with /bin/su - to get root and ${EDITOR:-/usr/bin/vim} /path/to/config/file to edit the file? You don't need a working root Dolphin, or even a working GUI of any sort, for either of those steps.
Because that is the way I prefer to do it because it is easier for me. One could make the argument that one doesn't need a GUI at all, for anything, if one wants to make it harder on themselves. One could even argue that no one even needs a computer at all. Right? That's not the question tho is it? The question is, how do I make dolphin work as root like it did before the update?

I might add, I use dolphin as root for other things as well. Either way, I need it to work. If I needed a GUI to hold my hand and protect me from myself, I'd use windoze. lol
One could also lash out in response to an innocent question. You wrote:
dalek wrote:
one can not update Gentoo without being root and editing files that only root can access.
While true, that seemed to me like you were equating the inability to use your favorite GUI as root with the complete inability to administer the system. That is not true. It may be less convenient for you if your favorite GUI will not let you use root, but unless using /bin/su - and $EDITOR are broken, system administration is still possible. I asked the question I did because I wanted to know why the inconvenient option was impossible for you. Based on your rather confrontational response, it appears that the answer is that it's possible, you just don't like it.

I expect your attitude will contribute strongly to your success getting this resolved.
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Wed Jul 25, 2018 6:10 am    Post subject: Reply with quote

wrc1944 wrote:

Anyway,back to dolphin. What happens if you open a konsole terminal, su to root, and then try running:
Code:
export XDG_CURRENT_DESKTOP=kde && dolphin
You still don't get a root dolphin window popping up, with kde icons?

Once I set this up, all I now need to do in a root terminal is type my "kdol" alias, and my root dolphin opens,



It works, sort of, when typed into a Konsole but does not work from a menu entry which is what I've used for years. When dealing with things as root, I like consistency to help prevent me from doing things I'm not used to having to do. When one starts changing the way they do things, it can lead to trouble.

Hu wrote:
dalek wrote:
Hu wrote:
What's wrong with /bin/su - to get root and ${EDITOR:-/usr/bin/vim} /path/to/config/file to edit the file? You don't need a working root Dolphin, or even a working GUI of any sort, for either of those steps.
Because that is the way I prefer to do it because it is easier for me. One could make the argument that one doesn't need a GUI at all, for anything, if one wants to make it harder on themselves. One could even argue that no one even needs a computer at all. Right? That's not the question tho is it? The question is, how do I make dolphin work as root like it did before the update?

I might add, I use dolphin as root for other things as well. Either way, I need it to work. If I needed a GUI to hold my hand and protect me from myself, I'd use windoze. lol
One could also lash out in response to an innocent question. You wrote:
dalek wrote:
one can not update Gentoo without being root and editing files that only root can access.
While true, that seemed to me like you were equating the inability to use your favorite GUI as root with the complete inability to administer the system. That is not true. It may be less convenient for you if your favorite GUI will not let you use root, but unless using /bin/su - and $EDITOR are broken, system administration is still possible. I asked the question I did because I wanted to know why the inconvenient option was impossible for you. Based on your rather confrontational response, it appears that the answer is that it's possible, you just don't like it.

I expect your attitude will contribute strongly to your success getting this resolved.


My attitude was sort of making a joke of your reply because the whole thing is silly which is why I mentioned windoze and even put a "lol" on the end. To be honest, I wish we could still login to KDE as root as well. As with the current issue, I can see why it should be disabled with other distros but this is Gentoo. We should be able to disable "features" we don't want. So, my attitude was making a joke of it and saying it is silly to make it work this way when the old way worked just fine and was a lot less trouble. In the end, it will likely lead to me doing less updates which can have its own security problems than me using GUI programs as root ever would, given I've used Gentoo for over a decade with no problems.

I find it odd that one has to login to Konsole as root where one can type in rm -rf /* to use a GUI where doing something like that is less likely. I suspect I'll find a way to make this work eventually. I'm not the only one that does it this way and prefers it.
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Fri Jul 27, 2018 8:54 am    Post subject: Reply with quote

After some thinking, I figured the best way to get rid of this problem long term was to stop using Dolphin at all. So, I started searching for a new GUI file manager that runs as root and I can start from a menu entry, like a GUI program should anyway. So far, I'm using Krusader. It runs as root from a menu entry and was very easy to set up that way as well. It only required me setting it to run as root in the menu entry and it worked fine.

Another option that I could use and as far as I can tell, has nothing to do with KDE at all, Xfe. If the Krusader devs decide to go down the same path as Dolphin, disabling running as root, I can use it as well. Hopefully the KDE devs won't break this one at least.

For those who like to have GUI tools that work correctly, at least within Gentoo who requires root access to edit config files, those are two options. There are others that can be found here.

https://www.tecmint.com/top-best-lightweight-linux-file-managers/

I found other sites that listed some as well but this is more recent and had more options. Hope this helps someone else who likes to do things the right way. I might add, this should be a longer term solution, especially the Xfe option.
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
natrix
Guru
Guru


Joined: 23 Aug 2013
Posts: 532

PostPosted: Sat Aug 04, 2018 4:11 pm    Post subject: Reply with quote

Hi!

I used the patchs in Kate and Dolphin 17.* and it works very fine!!!

But in the new update, the patchs not work with 18.04.3 version: Portage lauch a compile fail

How I must modify the patchs to both apps?

Thanks a lot!
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Sat Aug 04, 2018 4:31 pm    Post subject: Reply with quote

natrix wrote:
Hi!

I used the patchs in Kate and Dolphin 17.* and it works very fine!!!

But in the new update, the patchs not work with 18.04.3 version: Portage lauch a compile fail

How I must modify the patchs to both apps?

Thanks a lot!


I don't think anyone is going to fix the patches. I suspect if anyone was, they would have by now. You may want to read my post right above yours to see how I worked around this problem. It also has ideas for other long term fixes. Basically, I'm sort of moving away from the main KDE file manager(s) which in the long term, means they won't break them. That's my theory at least.
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 86

PostPosted: Sat Aug 04, 2018 6:08 pm    Post subject: Reply with quote

The matter is if you applying a patch, emerge fail to apply next patch : flto.patch.
Emerge fails to apply flto.patch after any main.cpp modification. Even if you added comment to source file (#)
Anyone knows why it occurs? Is there any file integrity check for main.cpp?

Or, may be, there is some way to change the order of patches applying?
At first step - apply that three patches that mentioned in ebuild, and at second step apply a patch which removes root restriction.

As for me, right know I downgraded dolphin to 17.X back.
Crusader isn't a serious option
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Sat Aug 04, 2018 9:19 pm    Post subject: Reply with quote

Blind_Sniper wrote:
Crusader isn't a serious option


Something to keep in mind, even if someone fixes the current patch, it will almost certainly break again. At some point, it could be done in a way that it can't even be patched out without breaking something else. The devs for Dolphin have made it clear that they don't want it running as root. As I've pointed out before, that may be reasonable for other distros but not good for Gentoo and those of us who need a file manager as root. At some point, it will either become a pain to keep it working or they will make it where patches won't fix it.

After thinking on this a while, I decided that while I prefer Konqueror and that dolphin was a reasonable replacement for that, neither is a option long term. Even in the short term, dolphin is not really a option since it no longer works as it really should without using a older and possible security risk version. That is why I chose a long term solution, find another file manager and hopefully one that has devs that doesn't think the same way Konqueror and Dolphin devs do. I tried a couple others but I didn't like them. Krusader works pretty well. Xfe is another option should that one fail to work later. While I didn't like some of the others that I tried, you may like them. They may be worth at least looking into. At some point, you may even be forced to whether you want to or not.
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 86

PostPosted: Sat Aug 04, 2018 10:48 pm    Post subject: Reply with quote

dalek wrote:
Blind_Sniper wrote:
Crusader isn't a serious option


Something to keep in mind, even if someone fixes the current patch, it will almost certainly break again. At some point, it could be done in a way that it can't even be patched out without breaking something else. The devs for Dolphin have made it clear that they don't want it running as root..


May be it's not so bad as you wrote:
https://pointieststick.wordpress.com/2018/06/02/this-week-in-usability-productivity-part-21
Have to wait and once dolphin-18.08 will be landed we can see, how to deal with it (if it will require at all)

Anyway we have a sources, isn't it?
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1336
Location: Mississippi USA

PostPosted: Sun Aug 05, 2018 12:54 am    Post subject: Reply with quote

Blind_Sniper wrote:


May be it's not so bad as you wrote:
https://pointieststick.wordpress.com/2018/06/02/this-week-in-usability-productivity-part-21
Have to wait and once dolphin-18.08 will be landed we can see, how to deal with it (if it will require at all)

Anyway we have a sources, isn't it?


One can hope. It just seems that KDE keeps doing things that don't work well for me. I'm still not happy with the way they did the switch from KDE3 to KDE4. They did better with the switch to 5 tho. Maybe they figured out they need a better plan. If Dolphin gets a proper fix to use it as root, great. I'll switch back and use it. In the meantime, Krusader, while different, works without me having to reinvent the wheel.

If KDE does leave it where we are unable to be root, that's fine. As I said, for most distros out there, it may be a better plan. Thing is, I use Gentoo and I need root when doing updates and some other things as well. It's not just updates for me.

Time will tell. In the meantime, use old version which may have issues or use something else like I am. I just like options. I'm to old to reinvent the wheel here. lol
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
lost+found
Guru
Guru


Joined: 15 Nov 2004
Posts: 508
Location: North~Sea~Coa~s~~t~~~

PostPosted: Sun Aug 05, 2018 5:25 am    Post subject: Reply with quote

Code:
$ su -
# KDE_SESSION_VERSION=5 KDE_FULL_SESSION=false dolphin &>/dev/null &


Prevents the missing icons mentioned in this thread.

Cheers.
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 86

PostPosted: Sun Aug 05, 2018 10:58 am    Post subject: Reply with quote

OK. I fixed a problem. Dolphin-18.04.3 can be run via kdesu again.
We failed with dolphin-18.x.x due to that patches, which was added to dolphin-18.x.x.ebuild by devs.
They are: flto.patch, root-user.patch, root-warn.patch. They allows to run dolphin if root directly logged into kde desktop.
Since we are going to use dolphin via kdesu, we do not need these patches at all.
So, what I did, step by step:

1. I opened /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild file and removed that three patches from there (see PATCHES section).
Now PATCHES section looks like this:
Code:
PATCHES=(
   "${FILESDIR}"/${P}-memleak-{1,2}.patch
)

Then I saved file.

2. I ran
Code:
ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild digest --force

It's important to run it with --force option, otherwise next steps will fail.

3.
Code:
ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild unpack


4. Navigated to /var/tmp/portage/kde-apps/dolphin-18.04.3-r1/work/dolphin-18.04.3/src directory, opened main.cpp file and removed this snippet of code:
Code:
#ifndef Q_OS_WIN
    // Check whether we are running as root
    if (getuid() == 0) {
        std::cout << "Executing Dolphin as root is not possible." << std::endl;
        return EXIT_FAILURE;
    }
#endif

Saved changes.

5. Just to be on the safe side ran this again :)
Code:
ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild digest --force

May be it was excessive...

6.
Code:
ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild compile


7.
Code:
 ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild install


8.
Code:
 ebuild /usr/portage/kde-apps/dolphin/dolphin-18.04.3-r1.ebuild qmerge



Thats all. Now I can run it again by
Code:
kdesu dolphin
:D

In fact it's the same procedure which we did with dolphin-17.x.x, with one additional patch for ebuild file itself.
Unfortunately I didn't learn how to create patch file (even after 8 years of using gentoo), so I did it "by hand", just editing file in the editor.
It would be nice if someone will create this patch file and posted it here.

Added: may be flto.patch isn't a part of problem, not sure. I just removed it because it was missed in previous 17.x.x ebuilds.
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 228

PostPosted: Sun Aug 05, 2018 1:37 pm    Post subject: Reply with quote

Here is my patch to be placed in /etc/portage/patches/kde-apps/dolphin

With this I can run again "kdesu dolphin" and without that stupid irritating "big scary warning".
Do our devs think they are dealing with idiots?

Code:

--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -108,14 +108,6 @@
     m_messageWidget->setCloseButtonVisible(true);
     m_messageWidget->hide();
 
-#ifndef Q_OS_WIN
-    if (getuid() == 0) {
-
-        // We must be logged in as the root user; show a big scary warning
-        showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
-    }
-#endif
-
     m_view = new DolphinView(url, this);
     connect(m_view, &DolphinView::urlChanged,
             m_urlNavigator, &KUrlNavigator::setLocationUrl);
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,26 +35,8 @@
 #include <QApplication>
 #include <QCommandLineParser>
 
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-#include <iostream>
-
 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
 {
-#ifndef Q_OS_WIN
-    // Prohibit using sudo or kdesu (but allow using the root user directly)
-    if (getuid() == 0) {
-        if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     QApplication app(argc, argv);
     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));


PS. If you need to run root dolphin through sudo, to make it show the folder icons you need to do this:
Code:
sudo KDE_SESSION_VERSION=5 KDE_FULL_SESSION=false dolphin

PPS. And remember, as someone mentioned above, we can still use Konqueror as root with sudo or su -

Code:
sudo konqueror --profile filemanagement
or even
Code:
sudo konqueror --profile midnightcommander
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3210
Location: Gainesville, Florida

PostPosted: Sun Aug 05, 2018 3:34 pm    Post subject: Reply with quote

Blind_Sniper & porteusx.
Great work! Thanks very much. :D
@porteusx,
Your patch isn't applying on my systems. It's in the correct place (as dolphin.patch, in /etc/portage/patches/kde-apps/) but doesn't apply.
Code:
>>> Emerging (1 of 1) kde-apps/dolphin-18.04.3-r1::gentoo
 * dolphin-18.04.3.tar.xz BLAKE2B SHA512 size ;-) ...                                                                                                                  [ ok ]
>>> Unpacking source...
>>> Unpacking dolphin-18.04.3.tar.xz to /var/tmp/portage/kde-apps/dolphin-18.04.3-r1/work
>>> Source unpacked in /var/tmp/portage/kde-apps/dolphin-18.04.3-r1/work
>>> Preparing source in /var/tmp/portage/kde-apps/dolphin-18.04.3-r1/work/dolphin-18.04.3 ...
 * Applying dolphin-18.04.1-flto.patch ...                                                                                                                             [ ok ]
 * Applying dolphin-18.04.3-root-user.patch ...                                                                                                                        [ ok ]
 * Applying dolphin-18.04.3-root-warn.patch ...                                                                                                                        [ ok ]
 * Applying dolphin-18.04.3-memleak-1.patch ...                                                                                                                        [ ok ]
 * Applying dolphin-18.04.3-memleak-2.patch ...                                                                                                                        [ ok ]
>>> Source prepared.

The other Nsane457 patches always applied over a year or so. I noticed in them there is a line on the top of the patch:
Code:
diff -Naur dolphin-17.04.0.old/src/main.cpp dolphin-17.04.0/src/main.cpp

Could that be the problem?
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.29-r2, gcc-8.3.0-r1 kernel-5.0.7-gentoo USE=experimental
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 228

PostPosted: Sun Aug 05, 2018 3:40 pm    Post subject: Reply with quote

Put the patch in /etc/portage/patches/kde-apps/dolphin/dolphin-18.04-root.patch
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 6825
Location: Austria

PostPosted: Sun Aug 05, 2018 3:55 pm    Post subject: Reply with quote

proteusx wrote:
With this I can run again "kdesu dolphin" and without that stupid irritating "big scary warning".
Do our devs think they are dealing with idiots?

"Your devs" are applying upstream patches, no more, no less. This is the same you will get with vanilla 18.08.
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3210
Location: Gainesville, Florida

PostPosted: Sun Aug 05, 2018 4:03 pm    Post subject: Reply with quote

Thanks much porteus!
I had carelessly in my haste placed the patch in the wrong directory (kde-apps) Fixed that, and your patch works great! :D

BTW, at:
https://gitweb.gentoo.org/proj/kde.git/commit/?id=3b121eeec9664c836213b5bca2ae0a851cd17507
it says in the patches summary:
Quote:
+Summary:
+Prohibiting the use of Dolphin as the actual root user (not using `sudo` or `kdesu`) breaks legitimate use cases for using the root user. An example is Kali, a distro that logs in as the root user by default as a deliberate design choice.
+
+In such an environment, there is no additional security vulnerability beyond what you're already potentially exposing yourself to. So, let's re-enable it.
+
+BUG: 387974
+FIXED-IN: 18.08.0
+
+Test Plan:
+- Log in as normal user and run `sudo dolphin`: you get an error message.
+- Log in as normal user and run `kdesu dolphin`: you get an error message.
+- Log in as the root user and run dolphin normally: it works.
+
+Reviewers: markg, elvisangelaccio, #dolphin
+
+Reviewed By: markg
+
+Subscribers: chinmoyr, cfeck, elvisangelaccio, mmustac, Fuchs, markg, graesslin, nicolasfella, zzag, kfm-devel, emmanuelp

I assume this means they are still trying to prevent kdesu dolphin, so hopefully your patch will work on 18.08 and beyond for at least a while like Nsane457's did on 17.04->.. :roll:

Again, many thanks!
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.29-r2, gcc-8.3.0-r1 kernel-5.0.7-gentoo USE=experimental
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 86

PostPosted: Sun Aug 05, 2018 4:54 pm    Post subject: Reply with quote

wrc1944 wrote:

I assume this means they are still trying to prevent kdesu dolphin

We have a sources, feel free to change that sources in any way you want. 8)
Back to top
View user's profile Send private message
natrix
Guru
Guru


Joined: 23 Aug 2013
Posts: 532

PostPosted: Sun Aug 05, 2018 8:39 pm    Post subject: Reply with quote

proteusx!!!

The patch work fine. Excelent contribution!!

Do you have a patch to run Kate how root? It has the same situation that dolphin.

Thanks!!
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 228

PostPosted: Sun Aug 05, 2018 9:06 pm    Post subject: Reply with quote

Patch for kate.

Code:

--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -52,26 +52,9 @@
 #include "qtsingleapplication/qtsingleapplication.h"
 #endif
 
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-#include <iostream>
-
 
 int main(int argc, char **argv)
 {
-#ifndef Q_OS_WIN
-    // Prohibit using sudo or kdesu (but allow using the root user directly)
-    if (getuid() == 0) {
-        if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Executing Kate with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
     /**
      * init resources from our static lib
      */
Back to top
View user's profile Send private message
natrix
Guru
Guru


Joined: 23 Aug 2013
Posts: 532

PostPosted: Mon Aug 06, 2018 12:02 am    Post subject: Reply with quote

Hi proteusx!! Thanks

The patch not work, emerge show this output. It was the same that dolphin:

Code:
 * ERROR: kde-apps/kate-18.04.3::gentoo failed (prepare phase):
 *   patch -p1  failed with /etc/portage/patches/kde-apps/kate/root.patch
 *
 * Call stack:
 *               ebuild.sh, line  124:  Called src_prepare
 *             environment, line 3856:  Called kde5_src_prepare
 *             environment, line 2881:  Called cmake-utils_src_prepare
 *             environment, line 1336:  Called default_src_prepare
 *      phase-functions.sh, line  932:  Called __eapi6_src_prepare
 *             environment, line  393:  Called eapply_user
 *             environment, line 1579:  Called eapply '/etc/portage/patches/kde-apps/kate/root.patch'
 *             environment, line 1549:  Called _eapply_patch '/etc/portage/patches/kde-apps/kate/root.patch'
 *             environment, line 1487:  Called __helpers_die 'patch -p1  failed with /etc/portage/patches/kde-apps/kate/root.patch'
 *   isolated-functions.sh, line  121:  Called die
 * The specific snippet of code:
 *              die "$@"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum