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
View posts from last 7 days

Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Thu Dec 05, 2019 1:18 am    Post subject: Reply with quote

Thank you very much that worked great. The kate patch worked as well but not the kwrite patch.
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Thu Dec 05, 2019 2:18 am    Post subject: Reply with quote

kwrite-19.08.3-run-as-root.patch
Code:

--- 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
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Thu Dec 05, 2019 2:34 am    Post subject: Reply with quote

Thanks again
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


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

PostPosted: Thu Dec 05, 2019 6:42 pm    Post subject: Reply with quote

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

Code:
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.40-r5, gcc-14
kernel-6.11.3 USE=experimental python3_12.7-final-0
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


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

PostPosted: Fri Dec 13, 2019 3:19 am    Post subject: Reply with quote

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:
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.40-r5, gcc-14
kernel-6.11.3 USE=experimental python3_12.7-final-0
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Fri Dec 13, 2019 4:41 am    Post subject: Reply with quote

dolphin-19.12.0-root.patch
Code:
--- 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
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


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

PostPosted: Fri Dec 13, 2019 5:00 am    Post subject: Reply with quote

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.40-r5, gcc-14
kernel-6.11.3 USE=experimental python3_12.7-final-0
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


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

PostPosted: Fri Dec 13, 2019 8:05 pm    Post subject: Reply with quote

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:
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.40-r5, gcc-14
kernel-6.11.3 USE=experimental python3_12.7-final-0
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Fri Dec 13, 2019 9:30 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
peakeyed
n00b
n00b


Joined: 18 Nov 2004
Posts: 60

PostPosted: Sat Jan 09, 2021 8:30 pm    Post subject: Thank you Reply with quote

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


Joined: 21 Jan 2008
Posts: 340

PostPosted: Sun Apr 25, 2021 3:42 am    Post subject: Reply with quote

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:
--- 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
      */
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1255

PostPosted: Sun Apr 25, 2021 7:12 am    Post subject: Reply with quote

Code:
EDITOR=kate sudoedit
Back to top
View user's profile Send private message
davidbryant
Apprentice
Apprentice


Joined: 11 Jun 2020
Posts: 162
Location: Canyon Lake, Texas

PostPosted: Sat May 01, 2021 11:50 pm    Post subject: Use /bin/su - root and dbus-launch Reply with quote

Whenever I need to run a program (like Dolphin, or Kate) as root, I just do this.
Code:
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:
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
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Sun May 02, 2021 9:13 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
davidbryant
Apprentice
Apprentice


Joined: 11 Jun 2020
Posts: 162
Location: Canyon Lake, Texas

PostPosted: Sun May 02, 2021 12:11 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2056
Location: United Kingdom

PostPosted: Sun May 02, 2021 3:17 pm    Post subject: Reply with quote

davidbryant,

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

Code:
$ 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:
$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate


Code:
$ 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:
$ 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:
$ 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:
#!/bin/bash
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin

Code:
$ 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
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Fri Aug 06, 2021 6:24 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Fri Aug 06, 2021 9:11 pm    Post subject: Reply with quote

Try this patch.
Code:
--- 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.
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Fri Aug 06, 2021 10:35 pm    Post subject: Reply with quote

Patch worked for both. Thanks
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Sat Aug 14, 2021 11:53 am    Post subject: {kate, kwrite}-21.08.0 run as root patch Reply with quote

Code:
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.
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Tue Jul 26, 2022 4:51 pm    Post subject: Reply with quote

Not having any luck with any of the patches on 22.04.3
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Wed Jul 27, 2022 2:30 pm    Post subject: Patches for {dolphin, kate, kwrite}-22.04.3 Reply with quote

dolphin-22.04.3-root.patch
Code:
 --- 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:
--- 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
      */
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Wed Jul 27, 2022 5:51 pm    Post subject: Reply with quote

The patches worked. Thanks again
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 19

PostPosted: Wed Nov 30, 2022 2:55 pm    Post subject: Reply with quote

Both kate and kwrite patchs failed on 22.08.3. The dolphin patch worked fine.
Back to top
View user's profile Send private message
proteusx
Guru
Guru


Joined: 21 Jan 2008
Posts: 340

PostPosted: Wed Nov 30, 2022 4:56 pm    Post subject: Reply with quote

Root patch for {kate,kwrite}-22.08.3
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, 5, 6, 7  Next
Page 6 of 7

 
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