5

When I try to launch KDE Partition Manager a KDE su dialogue pops up prompting me for root's password:

The action you requested needs root priviliges. Please enter root's passoword below or click Ignore to continue with your current privileges.

Command: KDE_FULL_SESSION=true XDG_RUNTIME_DIR=/run/usr/1000 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /usr/bin/partitionmanager --dontsu`

When I enter my user password, the dialogue box reappears with:

Permission denied. Possibly incorrect password, please try again. On some systems, you need to be in a special group (often: wheel) to use this program.

I've checked that my user is a part of the wheel group. And for terminal commands requiring admin privileges sudo + [myuserpassword] works as expected.

How can I launch KDE Partition Manager with admin privileges?

I'm running the KDE spin of Fedora 28. I created a user but have no root password set.

Veger
  • 119
Jason
  • 539

2 Answers2

5

The problem arises because kdesu tries to use su even if you haven't set a root password.

kdesu can be configured to use sudo instead of su. You need to create a file in ~/.config/kdesurc with the contents:

[super-user-command]
super-user-command=sudo

As per the instructions on the arch wiki. Link. Credit to @steeldriver for the answer.

Jason
  • 539
  • Do I need to restart something for that to work? Also, kdesu was working fine on Ubuntu 20.04 until I upgraded to 22.04. I'm trying to find out why. I did originally have to use ln -s /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu /usr/bin/kdesu and kwriteconfig5 --file kdesurc --group super-user-command --key super-user-command sudo, but redoing the last one didnt help. – alchemy Apr 11 '22 at 06:34
  • https://bugs.kde.org/show_bug.cgi?id=452532 – alchemy Apr 12 '22 at 03:15
  • @alchemy In Ubuntu 22.04 you don't need kdesu to start KDE Partition Manager. It uses polkit system and I think Ubuntu correctly configures polkit to use users password. kdesu is not getting a lot of development because it is mostly replaced by proper polkit helpers. in KDE Frameworks 5.92 kio framework also supports polkit, so Dolphin and I think Krusader just ask for your (or root) password when doing privileged operations but the GUI runs as normal user. – Andrius Štikonas Apr 12 '22 at 18:12
  • @AndriusŠtikonas thank you. that might explain it. I just tried su root krusader and I got Password:... /usr/bin/krusader: /usr/bin/krusader: cannot execute binary file yet running that same path as root works.. ah, sudo krusader works, but is there a reason I should not do that anymore, related to your comment below? – alchemy Apr 12 '22 at 18:15
  • @alchemy the reason is simply that GUI toolkits are not really designed to be run as root, it's much bigger attack surface."su root krusader" is wrong, that's not how su command works. "su root ls" would print the same error, see "man su" for more details. – Andrius Štikonas Apr 12 '22 at 18:31
  • @AndriusŠtikonas thats acceptable.. but am I not supposed to run as root by sudo? There is no other way I know of to use a file manager or other apps I need to have access to system files. – alchemy Apr 12 '22 at 18:32
  • @alchemy In short, sudo is fine for non GUI terminal apps. For GUI apps read here: https://pointieststick.com/2021/12/31/this-week-in-kde-finally-root-file-operations-in-dolphin/ – Andrius Štikonas Apr 12 '22 at 18:37
  • @AndriusŠtikonas that is great news that the polkit work is finally finished! I will try it in Dolphin and Kate. Until it comes to Krusader, I'll just use sudo in my .desktop file.. One comment and feel free to reply in chat about this.. why isnt PartitionManger called Kparted? are there features im missing in gparted? and also, is there any way to create an optional start screen that asked which disk or all to look at like in PuppyOS-gparted (script with GUI).. I have a raid disk that pops up a warning "backup gpt is corrupt" before it opens, no matter what I do on the disk partition table. – alchemy Apr 12 '22 at 18:49
  • @alchemy gparted uses libparted, that's where parted comes from, it's a library. KDE Partition Manager uses util-linux (sfdisk and friends), so parted in the name would be misleading. gparted is missing some features but so is KDE Partition Manager (but LUKS and LVM support is better in KPM). On the other hand RAID support might be better in GParted. – Andrius Štikonas Apr 12 '22 at 23:46
1
sudo /usr/bin/partitionmanager
Ipor Sircer
  • 14,546
  • 1
  • 27
  • 39
  • 2
    I always thought that running GUI programs with sudo was discouraged? – Jason Aug 18 '18 at 14:14
  • 2
    Don't run partitionmanager like this. Things might break if you use sudo (note, I am the maintainer of KDE Partition Manager). – Andrius Štikonas Aug 27 '18 at 11:47
  • Okay, that's fine, but then what to do instead? I also can't launch it without sudo. – Attila Jan 04 '19 at 23:07
  • @Attila You can configure kdesu to use sudo instead of su by following the instructions on this page https://wiki.archlinux.org/index.php/sudo#kdesu – Jason Jan 05 '19 at 13:34
  • @AndriusŠtikonas if you have a moment could you take a look at my issue described in the comments of the above answer from Jason? I filled a bug report, but perhaps I missed something simple, as it was working. – alchemy Apr 12 '22 at 03:17