Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

kdesu dolphin as root not possible [SOLVED-again]

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
164 posts
  • Page 6 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next
Author
Message
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Thu Dec 05, 2019 1:18 am

Thank you very much that worked great. The kate patch worked as well but not the kwrite patch.
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Thu Dec 05, 2019 2:18 am

kwrite-19.08.3-run-as-root.patch

Code: Select all

--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -51,18 +51,6 @@
 
 extern "C" Q_DECL_EXPORT 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 KWrite with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif

     /**
      * Create application first
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Thu Dec 05, 2019 2:34 am

Thanks again
Top
wrc1944
Advocate
Advocate
Posts: 3467
Joined: Thu Aug 15, 2002 10:33 am
Location: Gainesville, Florida

  • Quote

Post by wrc1944 » Thu Dec 05, 2019 6:42 pm

The dolphin-19.08.1 patch still works on all three of my ~amd64 Gentoo installs.

Code: Select all

diff -Naur orig/src/dolphinviewcontainer.cpp patched/src/dolphinviewcontainer.cpp
--- orig/src/dolphinviewcontainer.cpp   2019-09-03 00:15:08.000000000 +0300
+++ patched/src/dolphinviewcontainer.cpp   2019-09-15 12:45:14.451444593 +0300
@@ -136,13 +136,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
 
     // Initialize filter bar
     m_filterBar = new FilterBar(this);
diff -Naur orig/src/main.cpp patched/src/main.cpp
--- orig/src/main.cpp   2019-09-03 00:15:08.000000000 +0300
+++ patched/src/main.cpp   2019-09-15 12:43:55.923439868 +0300
@@ -46,19 +46,6 @@
 
 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()));
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.41-r2, gcc-15.1.0
kernel-6.15.6 USE=experimental python3.13.3
Top
wrc1944
Advocate
Advocate
Posts: 3467
Joined: Thu Aug 15, 2002 10:33 am
Location: Gainesville, Florida

  • Quote

Post by wrc1944 » Fri Dec 13, 2019 3:19 am

Hmmm. Updated kde to 19.12.0, and again have dolphin as root (kdesu) problems. Rebuilt kde-cml and dolphin, but again kdesu dolphin, and the newest dolphin-as-root-19.08.3.patch can't work since kdesu seems to be non-functional. From a root konsole a plain dolphin opens up a root dolphin, but has the "Running Dolphin as root can be dangerous. Please be careful." message appears at top in window. (I'm running ~amd64 systems)

Here's the output where kdesu dolphin returns nothing, but root konsole dolphin at least works. What's the pinentry-qt.desktop" has Type= "Application" but no Exec line have to do with dolphin?

Code: Select all

wrc@gentoo-main ~ $ kdesu dolphin
wrc@gentoo-main ~ $ su
Password: 
gentoo-main ~ # dolphin
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kservice.services: The desktop entry file "/usr/share/applications/org.gnupg.pinentry-qt.desktop" has Type= "Application" but no Exec line
kf5.kservice.sycoca: Invalid Service :  "/usr/share/applications/org.gnupg.pinentry-qt.desktop"
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'
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
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'
kf5.kio.kio_tags: tag fetch failed: "Failed to open the database"
kf5.kio.kio_tags: "tags:/" list() invalid url
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'
kf5.kio.core: "Could not enter folder tags:/."
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'
Qt: Session management error: networkIdsList argument is NULL
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.41-r2, gcc-15.1.0
kernel-6.15.6 USE=experimental python3.13.3
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Fri Dec 13, 2019 4:41 am

dolphin-19.12.0-root.patch

Code: Select all

--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -136,13 +136,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
 
     // Initialize filter bar
     m_filterBar = new FilterBar(this);
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -46,19 +46,6 @@
 
 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
-
     /**
      * enable high dpi support
      */
EDIT: Deleted blank line from listing
Last edited by proteusx on Fri Dec 13, 2019 9:30 pm, edited 1 time in total.
Top
wrc1944
Advocate
Advocate
Posts: 3467
Joined: Thu Aug 15, 2002 10:33 am
Location: Gainesville, Florida

  • Quote

Post by wrc1944 » Fri Dec 13, 2019 5:00 am

WOW! Thanks very much for the light-speed response! :D
I'm sure lots of users (along with me) really appreciate you maintaining these great Dolphin and Kwrite patches.
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.41-r2, gcc-15.1.0
kernel-6.15.6 USE=experimental python3.13.3
Top
wrc1944
Advocate
Advocate
Posts: 3467
Joined: Thu Aug 15, 2002 10:33 am
Location: Gainesville, Florida

  • Quote

Post by wrc1944 » Fri Dec 13, 2019 8:05 pm

proteusx,
Patch worked great on my three Gentoo installs, however I did notice a minor fuzz factor.
Doesn't seem to affect anything, or could it be only some problem on my systems?

Code: Select all

unpacking source...
>>> Unpacking dolphin-19.12.0.tar.xz to /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Source unpacked in /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Preparing source in /var/tmp/portage/kde-apps/dolphin-19.12.0/work/dolphin-19.12.0 ...
 * Applying dolphin-19.12.0-root.patch ...
 *     /etc/portage/patches/kde-apps/dolphin/dolphin-19.12.0-root.patch: patch failed to apply without a fuzz factor, please rebase
patching file src/dolphinviewcontainer.cpp
patching file src/main.cpp
Hunk #1 succeeded at 46 with fuzz 1.                                                                                                              [ ok ]
 * User patches applied.
>>> Source prepared
.
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.41-r2, gcc-15.1.0
kernel-6.15.6 USE=experimental python3.13.3
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Fri Dec 13, 2019 9:30 pm

Probably copy/paste caused the patch to be out by one line.
Maybe it is the first blank line at the top.
Fixed now.


EDIT. No. It is not that. I cannot reproduce the error here.
Top
peakeyed
n00b
n00b
User avatar
Posts: 60
Joined: Thu Nov 18, 2004 5:30 am

Thank you

  • Quote

Post by peakeyed » Sat Jan 09, 2021 8:30 pm

Thanks proteusx
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Sun Apr 25, 2021 3:42 am

kde-apps/{kate, kwrite}-21.04.0 run as root, updated patch

Same patch for both.
In the first two lines replace /kate/kwrite/

Code: Select all

--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -45,24 +45,6 @@

 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. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
     /**
      * init resources from our static lib
      */
Top
Perfect Gentleman
Veteran
Veteran
User avatar
Posts: 1301
Joined: Sun May 18, 2014 10:16 am
Contact:
Contact Perfect Gentleman
Website

  • Quote

Post by Perfect Gentleman » Sun Apr 25, 2021 7:12 am

Code: Select all

EDITOR=kate sudoedit
Top
davidbryant
Apprentice
Apprentice
User avatar
Posts: 250
Joined: Thu Jun 11, 2020 3:36 pm
Location: Canyon Lake, Texas
Contact:
Contact davidbryant
Website

Use /bin/su - root and dbus-launch

  • Quote

Post by davidbryant » Sat May 01, 2021 11:50 pm

Whenever I need to run a program (like Dolphin, or Kate) as root, I just do this.

Code: Select all

david@localhost ~ $ /bin/su - root
Password: 
localhost ~ # dbus-launch dolphin
It works great. No need for patches. I've also used it with Ubuntu, Debian, openSUSE, Manjaro and Endeavour (ARCH-based distros), Linux Mint, MX19, etc. It seems to work just about anywhere. The patches are aimed at the sudo command and derivatives. If you're actually logged in as root, you slide right past the "safety" code.


A few distros, mainly Debian derivatives like Ubuntu, don't create a password for root when installed from the .iso file. That's easily fixed with

Code: Select all

david@localhost ~ $ sudo passwd
which will let you create a root password. Then you can use "/bin/su - root", no problems.
David Bryant
Canyon Lake, Texas
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Sun May 02, 2021 9:13 am

These patches are meant to revert certain changes upstream that broke Dolphin (as well as Kwrite and Kate) for some of us who used it for a long time it in a certain way. I know little about non-gentoo distros.
Top
davidbryant
Apprentice
Apprentice
User avatar
Posts: 250
Joined: Thu Jun 11, 2020 3:36 pm
Location: Canyon Lake, Texas
Contact:
Contact davidbryant
Website

  • Quote

Post by davidbryant » Sun May 02, 2021 12:11 pm

proteusx wrote:These patches are meant to revert certain changes upstream that broke Dolphin (as well as Kwrite and Kate) for some of us who used it for a long time it in a certain way. I know little about non-gentoo distros.
I understand that. I'm not finding fault with writing your own code. It does seem to me it could get to be a hassle applying patches to somebody else's code, especially if they keep moving things around. But most of my coding experience is on older hardware (IBM s/360, etc.), in assembly language. Maybe things are easier now.

Since the upstream coders have made explicit provision for the root user, why not just make yourself root when necessary, and avoid the hassle of maintaining a set of patches? To me that seems like the simpler approach. KISS is still good advice. But, to each his own, as they say. (Besides which, the whole "sudo" flapdoodle seems rather silly, to me. I have a set of maintenance tasks I perform once each day. I log in as root, get them done, and then logout. It generally takes 15 - 20 minutes ... sometimes longer if Portage wants to compile a lot of stuff. Practically speaking, it's just as safe as "sudo", and it saves me some keystrokes. And it works on any Linux distro, if you know the root password. Even Gentoo! I also understand that some Gentoo users function as sysadmins, with lots of users who need some limited privileges, but can't be trusted with full root access. "Sudo" makes sense in that situation. For the single user with a home computer, not so much.)
David Bryant
Canyon Lake, Texas
Top
Fitzcarraldo
Advocate
Advocate
User avatar
Posts: 2057
Joined: Sat Aug 30, 2008 9:49 pm
Location: United Kingdom
Contact:
Contact Fitzcarraldo
Website

  • Quote

Post by Fitzcarraldo » Sun May 02, 2021 3:17 pm

davidbryant,

It is also possible to launch Dolphin as root from a user account by using the pkexec command:

Code: Select all

$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin


Dolphin first displays an orange-coloured box with the warning message 'Running Dolphin as root can be dangerous. Please be careful.' and you can then browse and open root-owned directories and files.

You can also launch Kate and KWrite as root from your user account in the same way:

Code: Select all

$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate

Code: Select all

$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kwrite
You can set an alias in your ~/.bashrc for the three commands:

Code: Select all

$ tail -n 3 ~/.bashrc
alias dolroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin"
alias kateroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate"
alias kwriteroot="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kwrite"
Makes it easy to launch them as root from e.g. Konsole or Yakuake:

Code: Select all

$ dolroot
$ kateroot
$ kwriteroot
However, if an alias is used, rooted-Dolphin/Kate/KWrite can be launched from the command line but cannot be launched via KDE’s Application Launcher menu or KRunner. On the other hand, if a wrapper script is used, rooted-Dolphin/Kate/KWrite can be launched from the user’s command line and via KDE’s Application Launcher menu (and therefore via KRunner too). For example, I created three tiny Bash scripts dolroot, kateroot and kwriteroot. The scripts simply contain the aforementioned pkexec command. For example, dolroot contains:

Code: Select all

#!/bin/bash
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin

Code: Select all

$ chmod 700 dolroot
$ chmod 700 kateroot
$ chmod 700 kwriteroot
$ ls -la *root
-rwx------ 1 fitzcarraldo fitzcarraldo 115 Jul 30 15:33 dolroot
-rwx------ 1 fitzcarraldo fitzcarraldo 112 Jul 30 15:34 kateroot
-rwx------ 1 fitzcarraldo fitzcarraldo 114 Jul 30 15:34 kwriteroot
After adding entries for dolroot, kateroot and kwriteroot to the KDE Application Launcher’s menu, you can press Alt+F2 as usual to display the KRunner launcher then enter ‘dolroot’, ‘kateroot’ or ‘kwriteroot’ (without the quotes, obviously) in the KRunner window to launch Dolphin/Kate/KWrite as root user. A window will pop-up for you to enter the root user’s password. Once you have entered the root user’s password, the application will be launched.

I much prefer this to having to patch Dolphin, Kate and KWrite.
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.

My blog
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Fri Aug 06, 2021 6:24 pm

The patch for dolphin still worked for me on version 21.04.3 but not kate and kwrite. Is this just me or has anyone else see this too?
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Fri Aug 06, 2021 9:11 pm

Try this patch.

Code: Select all

--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -45,24 +45,6 @@

 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. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
     /**
      * init resources from our static lib
      */
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -37,25 +37,6 @@

 extern "C" Q_DECL_EXPORT 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 KWrite with sudo is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use KWrite normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use KWrite normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     /**
      * enable high dpi support
      */
Same patch for both kate and kwrite.
I just tested it and it works.
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Fri Aug 06, 2021 10:35 pm

Patch worked for both. Thanks
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

{kate, kwrite}-21.08.0 run as root patch

  • Quote

Post by proteusx » Sat Aug 14, 2021 11:53 am

Code: Select all

diff -Naur kate-21.08.0-orig/kate/main.cpp kate-21.08.0/kate/main.cpp
--- kate-21.08.0-orig/kate/main.cpp	2021-08-05 05:13:14.000000000 +0300
+++ kate-21.08.0/kate/main.cpp	2021-08-13 21:32:06.297158874 +0300
@@ -45,24 +45,6 @@
 
 int main(int argc, char **argv)
 {
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
-    // 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. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use Kate normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
     /**
      * init resources from our static lib
      */
diff -Naur kate-21.08.0-orig/kwrite/main.cpp kate-21.08.0/kwrite/main.cpp
--- kate-21.08.0-orig/kwrite/main.cpp	2021-08-05 05:13:14.000000000 +0300
+++ kate-21.08.0/kwrite/main.cpp	2021-08-13 21:32:44.912161356 +0300
@@ -37,25 +37,6 @@
 
 extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
 {
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
-    // Prohibit using sudo or kdesu (but allow using the root user directly)
-    if (getuid() == 0) {
-        if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Executing KWrite with sudo is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use KWrite normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities. "
-                         "It is also not necessary; simply use KWrite normally, and you will be prompted for "
-                         "elevated privileges when saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     /**
      * enable high dpi support
      */
Same patch for both.
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Tue Jul 26, 2022 4:51 pm

Not having any luck with any of the patches on 22.04.3
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

Patches for {dolphin, kate, kwrite}-22.04.3

  • Quote

Post by proteusx » Wed Jul 27, 2022 2:30 pm

dolphin-22.04.3-root.patch

Code: Select all

 --- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -87,14 +87,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
-
     // Initialize filter bar
     m_filterBar = new FilterBar(this);
     m_filterBar->setVisible(GeneralSettings::filterBar());
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -40,25 +40,6 @@

 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 << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Dolphin normally and you will be prompted for elevated privileges when "
-                         "performing file operations that require them."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Dolphin normally and you will be prompted for elevated privileges when "
-                         "performing file operations that require them."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     /**
      * enable high dpi support
      */

kate-22.04.3-root.patch (Good for kwrite too).

Code: Select all

--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -46,24 +46,6 @@

 int main(int argc, char **argv)
 {
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
-    // Prohibit using sudo or kdesu (but allow using the root user directly)
-    if (getuid() == 0) {
-        if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Running Kate with sudo can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Kate normally and you will be prompted for elevated privileges when "
-                         "saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Running Kate with kdesu can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Kate normally and you will be prompted for elevated privileges when "
-                         "saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
     /**
      * init resources from our static lib
      */
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -38,25 +38,6 @@

 extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
 {
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
-    // Prohibit using sudo or kdesu (but allow using the root user directly)
-    if (getuid() == 0) {
-        if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Running KWrite with sudo can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use KWrite normally and you will be prompted for elevated privileges when "
-                         "saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Running KWrite with kdesu can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use KWrite normally and you will be prompted for elevated privileges when "
-                         "saving documents if needed."
-                      << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     /**
      * enable high dpi support
      */
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Wed Jul 27, 2022 5:51 pm

The patches worked. Thanks again
Top
psands
n00b
n00b
Posts: 19
Joined: Mon Aug 12, 2019 12:40 am

  • Quote

Post by psands » Wed Nov 30, 2022 2:55 pm

Both kate and kwrite patchs failed on 22.08.3. The dolphin patch worked fine.
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Wed Nov 30, 2022 4:56 pm

Root patch for {kate,kwrite}-22.08.3
Top
Post Reply

164 posts
  • Page 6 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic