Topic locked

How to run Dolphin as root?

User avatar firef
Registered Member
Posts
23
Karma
0
OS

run Dolphin as root -- inside

Tue Dec 04, 2018 11:15 am
Code: Select all
su root

DISPLAY=:0 dolphin


works with current rolling Dolphin Version 18.08.3 o)

this is a complete farce. why are developers fighting their own users ? >:(

they come across as condesending and acting like a bloody nanny-state operative. depressing ! :'(

sudo bash ; DISPLAY=:0 dolphin still breaks with
Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities.

thanks to guys like graesslin:

Honestly I don't think we need to support that. If a user really wants that they can patch dolphin. We don't have to support every user wish. If I would have supported every user wish KWin would be an unmaintainable monster.

Also I think it's a really stupid idea to run the session as root. Yes users might do that but we are not obliged to support their crazy ideas. (That reminds me: I need to patch kwin_wayland to disallow running as root)

Security and usability are always in direct competition to each user. Sometimes it's important to lean more towards security and sometimes it's important to go more towards usability. The usability gain here is rather low while at the same time it's a security risk. The improvement you suggest here only benefits a very small subset of our user group (most distros just don't allow logging in as root anyway). Given that I would say that this is a case that the benefits for security are more important than the benefits for usability.


none of what he says is true ! >:( >:( >:( >:( >:( >:( >:( >:( >:(
User avatar firef
Registered Member
Posts
23
Karma
0
OS

modify dolphin to run as root

Tue Dec 04, 2018 1:53 pm
download + unzip the version of dolphin-sources of which u run the binary, such as v.18.08 from e.g.
https://github.com/KDE/dolphin/archive/v18.08.3.tar.gz

run KDevelop Appimage and open the project.

modify (copy + paste) main.cpp such that it reads from line 43 like this:

Code: Select all
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;      //  complete bs
            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()));

    KCrash::initialize();

    Kdelibs4ConfigMigrator migrate(QStringLiteral("dolphin"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("dolphinrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("dolphinpart.rc") << QStringLiteral("dolphinui.rc"));
    migrate.migrate();

    KLocalizedString::setApplicationDomain("dolphin");

    KAboutData aboutData(QStringLiteral("dolphin"), i18n("Dolphin"), QStringLiteral(DOLPHIN_VERSION_STRING),
                         i18nc("@title", "File Manager"),
                         KAboutLicense::GPL,
                         i18nc("@info:credit", "  modded to run as root by hacker dude in 2018      "));


configure , build , install (modify settings: install as root)

done ! you have a hacked version of dolphin and the hostile developers who introduced the bad feature-kill can no longer do harm to your workflow !

seems, like we KDE users are on out own ! let's keep up the good work of undoing the poor decisions other people try to make for us !
User avatar abury
Registered Member
Posts
142
Karma
0
OS

Re: How to run Dolphin as root?

Thu Dec 06, 2018 5:54 pm
Thanks @firef for the patch idea...
... Also I think it's a really stupid idea to run the session as root... (most distros just don't allow logging in as root anyway)...

Let's agree to disagree that some devs are idiots for imposing their opinions on KDE mortals!
However I don't have KDevelop--and yes, I know it merely requires an install--but my experience with builds is that I've yet to have one actually be successful...
IS there anyway that a patched /usr/bin/dolphin executable--for 4:18.08.3--can be made available as a download?
I typically use Krusader--when I need a root session--and would overwriting my version with a patched one be sufficient?


Kubuntu 19.10 - Plasma 5.18.3 - Frameworks 5.67.0 - Qt 5.12.4 - Kernel 5.3.0-51
User avatar zachus
Registered Member
Posts
51
Karma
0
OS
abury wrote:Thanks @firef for the patch idea...
... Also I think it's a really stupid idea to run the session as root... (most distros just don't allow logging in as root anyway)...

Let's agree to disagree that some devs are idiots for imposing their opinions on KDE mortals!


indeed it would be nice to have a root-dolphin-AppImage , like an .EXE click + run + enjoy

who creates one ? It sure is more difficult than the above build. :z

it is shocking >:( to see the dissosonance between that official "comradery" talk all across planet KDE, and then see certain operatives >:D (see quote above) thwart efforts to improve KDE overall by imposing their personal, often less relevant, opinions on the KDE user base. And then see edit wars like this : https://userbase.kde.org/index.php?titl ... leshooting to make it as difficult as possible for Dolphin users to get dolphin doing what they need.


User avatar abury
Registered Member
Posts
142
Karma
0
OS
zachus wrote:indeed it would be nice to have a root-dolphin-AppImage , like an .EXE click + run + enjoy

I wasn't thinking of Windoze .exe as such... rather the actual binary executable--path mentioned above--and as such @firef would already have that patched dolphin file; so if we could download it--from a url that he provides--then it's a simple sudo command line to replace my existing one... and no build required on my end!

It does imply however that when a new version update occurs--i.e. replaces the patched one--we would have to iterate this process; but that would be a small inconvenience and worth the effort of having a patched dolphin that doesn't require me to use a root-access-krusader process!


Kubuntu 19.10 - Plasma 5.18.3 - Frameworks 5.67.0 - Qt 5.12.4 - Kernel 5.3.0-51
giwiniswut
Registered Member
Posts
1
Karma
0

Re: How to run Dolphin as root?

Sun Feb 02, 2020 10:55 am
As you can see in the source code, only some environment variables are getting checked. Thus, clearing them prior to launching dolphin will trick that check.
Keep in mind though, that clearing these environment variables could have side effects.
From a terminal, running this should work:
Code: Select all
sudo sh -c "unset SUDO_USER; unset KDESU_USER; dolphin"
User avatar baxi
Registered Member
Posts
1
Karma
0
OS

Re: How to run Dolphin as root?

Wed Feb 12, 2020 9:43 pm
I found a simple workaround by using the ssh server:

1. Install openssh-server (link to Ubuntu tutorial: https://wiki.ubuntuusers.de/SSH/ )
2. Edit '/etc/ssh/sshd_config':
PermitRootLogin yes

If you just want to use the shh server for this workaround and prohibit any external connections pls add:
ListenAddress 127.0.0.1

3. Go to dolphin -> network -> add network folder
3.1 choose 'secure shell (ssh)'
3.2 Fill in:
Name: 'Name your connection here' (I alwys add 'root' in the name, to not forget that this is root...)
User: root
Server: 127.0.0.1
Port: 22
Folder: /
3.3 Press 'yes" to accept the key.
3.4 fill in your root password
check 'Remember password'

Done

Your full root access is now stored in the network folder.
To get full root access via dolphin just open this folder.
If you open a file in kate by using this folder, it has full root access too.
Anything here has now root access.

With left click 'Add to places' you can add it to the left sidebar
for quick access.
Fabian42
Registered Member
Posts
5
Karma
0

Re: modify dolphin to run as root

Fri Feb 28, 2020 4:39 am
firef wrote:download + unzip the version of dolphin-sources of which u run the binary, such as v.18.08 from e.g.
https://github.com/KDE/dolphin/archive/v18.08.3.tar.gz

run KDevelop Appimage and open the project.

modify (copy + paste) main.cpp such that it reads from line 43 like this:

[…]

configure , build , install (modify settings: install as root)

[…]


How would I do this? It seems like Dolphin uses some exotic build system called "kdesrc-build" that simply refuses to work no matter what I do. I installed that program, ran "sudo kdesrc-build --no-src" and it complains about not finding the configuration file, despite the error message stating explicitly that it would look at the path where the configuration file already is!

Is there a simpler way to build Dolphin, by using one of the usual methods?
airdrik
Registered Member
Posts
1854
Karma
5
OS

Re: How to run Dolphin as root?

Tue Mar 03, 2020 7:04 pm
kdesrc-build is a wrapper around various tools used for pulling and updating the sources of the various projects and building them, usually using cmake. It's convenient in its ability to update the git sources, build dependencies of the selected project(s) in the appropriate order and do a lot of things for you if you care about keeping up-to-date with the latest changes.

Most KDE projects use the cmake build system, which Kdevelop understands and can help you with (including checking out the sources for you if you haven't done that yet). With the Dolphin source project open in Kdevelop, you can use KDevelop's menus to configure, build and install the project.

If you want to use the command-line instead, you should be able to compile using:
Code: Select all
cd path/to/dolphin
# create a separate build directory:
mkdir build && cd build
# use cmake to configure the build (there are flags you can set to configure installation location and other features)
cmake ..
# to build the project:
make
# to install (as root):
make install


airdrik, proud to be a member of KDE forums since 2008-Dec.
Fabian42
Registered Member
Posts
5
Karma
0

Re: How to run Dolphin as root?

Tue Mar 03, 2020 10:41 pm
I ran into an error and solved it with this: https://superuser.com/a/912259/681763
Then I ran into another error and solved it by installing "kdoctools".
Then I ran into another error and solved it by installing "ruby-test-unit".
Then "cmake .." finally worked. "make" worked without issues, "make install" only worked with sudo.

Now to running Dolphin:
Without sudo it works fine.
With sudo I get "Session bus not found\nTo circumvent this problem try the following command (with Linux and bash)\nexport $(dbus-launch)", but running that command does not fix it.
I can't install "kdesudo", because "kdelibs" does not compile, see: https://aur.archlinux.org/packages/kdelibs/
Running it with "kdesu" requires to first add this in "sudo visudo":
Code: Select all
fabian ALL=(ALL) ALL
Defaults:fabian      !authenticate

Otherwise I get a password prompt that does not accept an empty password.
But even if I do that, Dolphin does not launch. All the output I get it this:
Code: Select all
qt5ct: using qt5ct plugin
org.kde.kdesud: priority set to  50
org.kde.kdesud: Scheduler set to  0
Don't need password!!

There is also no Dolphin process running afterwards.

So I'm basically back at the original question: How do I run Dolphin as root, this time with the modified code?
wolfi323
Registered Member
Posts
1128
Karma
11
OS

Re: How to run Dolphin as root?

Thu Mar 05, 2020 7:02 am
Fabian42 wrote:With sudo I get "Session bus not found\nTo circumvent this problem try the following command (with Linux and bash)\nexport $(dbus-launch)", but running that command does not fix it.

Try this:
Code: Select all
sudo dbus-launch dolphin

This should start a dbus session for root before running dolphin, and therefore avoid the error.

I can't install "kdesudo", because "kdelibs" does not compile, see: https://aur.archlinux.org/packages/kdelibs/

Kdelibs(4) is dead and unsupported since a bit more than two years, Qt4 even longer.

Running it with "kdesu" requires to first add this in "sudo visudo":
Code: Select all
fabian ALL=(ALL) ALL
Defaults:fabian      !authenticate

Otherwise I get a password prompt that does not accept an empty password.
But even if I do that, Dolphin does not launch.

kdesu actually uses 'su' to switch to root by default. So the sudo config should have no influence at all.
AFAIK, the only way to make 'su' work without a password, is to explicitly set an empty password for root (might need adjustments to the PAM config too to actually allow it).
But you certainly don't want to go that road, do you? ;)

It is possible to configure kdesu to use 'sudo' though, see https://wiki.archlinux.org/index.php/Sudo#kdesu.
If it still doesn't work then, something in your /etc/sodoers must be setup wrong I suppose.

To allow a user to use sudo without a password can be done by this:
Code: Select all
fabian ALL=(ALL) NOPASSWD: ALL

instead of your
Code: Select all
fabian ALL=(ALL) ALL
Defaults:fabian      !authenticate

Of course you could also restrict that to only allow certain commands. (but then, if you are able to run dolphin as root, you can do anything as root e.g. in the built-in konsole, so it doesn't really matter much anymore I suppose)
Fabian42
Registered Member
Posts
5
Karma
0

Re: How to run Dolphin as root?

Thu Mar 05, 2020 8:06 am
wolfi323 wrote:
Fabian42 wrote:Try this:
Code: Select all
sudo dbus-launch dolphin

This should start a dbus session for root before running dolphin, and therefore avoid the error.

Thanks, that finally worked!
Re-applying the theme was pretty easy: I needed to run "qt5ct" as sudo and apply the same theme settings that I had already done for my regular user, then apply the stylesheet the usual way as described here: https://askubuntu.com/a/879558/730949a
Binding it to a key or putting it into the menu was a bit more complicated, because it usually requires inputting a password and both methods do not open any password prompt, so they just silently fail. It would have worked to make it open a terminal with that password prompt, which automatically closes afterwards, but instead I just added myself to a file in /etc/sudoers.d like this: https://askubuntu.com/a/878705/730949

Thanks for your help! Now I can finally use a non-terminal root file manager with 7zip integration, black theme and generally everything one could wish for!
User avatar firef
Registered Member
Posts
23
Karma
0
OS

run Dolphin as root

Thu Apr 23, 2020 11:28 am
sudo dbus-launch dolphin
Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities.


:'( :-\ :<
Fabian42
Registered Member
Posts
5
Karma
0

Re: run Dolphin as root

Thu Apr 23, 2020 3:25 pm
firef wrote:
sudo dbus-launch dolphin
Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities.


:'( :-\ :<

Aren't you the one who posted the solution?
User avatar firef
Registered Member
Posts
23
Karma
0
OS

Re: run Dolphin as root

Thu Apr 23, 2020 6:54 pm
Fabian42 wrote:
firef wrote:
sudo dbus-launch dolphin
Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities.


:'( :-\ :<

Aren't you the one who posted the solution?


well, on another distro I suppose. Now its no longer working. dang! :o

 
Topic locked

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], carlitosh, exahamza, Google [Bot], jkurutz, razorrob, Sogou [Bot], Yahoo [Bot]