Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] How do I "graphical-sudo" under KDE (not "su")?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4950
Location: Dark side of the mood

PostPosted: Tue Jul 03, 2018 4:53 pm    Post subject: [SOLVED] How do I "graphical-sudo" under KDE (not Reply with quote

Hi again.

I have recently installed a brand new KDE/Plasma machine — I'm a long time Xfce user, Plasma is all new to me. I've come across a few settings that require root privileges to change. In the GTK world there is gksu. I can only find kdesu here. Thing is root has no password on my machine — and I don't intend to set one. Is there a way to have KDE/Polkit/pkexec/whatever ask for a password in a sudo fashion?

Thanks in advance.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!


Last edited by VinzC on Sun Jul 08, 2018 1:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 19590
Location: here

PostPosted: Tue Jul 03, 2018 7:41 pm    Post subject: Reply with quote

Can help this?
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4950
Location: Dark side of the mood

PostPosted: Tue Jul 03, 2018 8:13 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Can help this?

Awesome! Thanks!
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4950
Location: Dark side of the mood

PostPosted: Tue Jul 03, 2018 11:17 pm    Post subject: Reply with quote

Well, spoke too early. That didn't work :-( . I'm still asked for [non-existing] root password...

FTR, [how I'd call it] the DBus message is org.freedesktop.accounts.user-administration.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


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

PostPosted: Wed Jul 04, 2018 10:09 am    Post subject: Reply with quote

I wonder if the reason the changes given in that Arch Linux Wiki article don't work is something to do with the way your sudoers file is configured. What do you currently have in that file?

Code:
sudo grep -v ^# /etc/sudoers

_________________
Clevo W230SS: amd64, OpenRC, nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64, OpenRC, xf86-video-ati, dual booting with Win 7 Pro 64-bit.
KDE on both laptops.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


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

PostPosted: Wed Jul 04, 2018 11:42 am    Post subject: Reply with quote

Scratch my previous post. I have found that I have to create the file kdesurc in both ~/.config/ and ~/.kde4/share/config/ directories, despite this being KDE Plasma 5. Then the procedure in the Arch Linux Wiki works.

Code:
$ nano ~/.config/kdesurc
$ cat ~/.config/kdesurc
[super-user-command]
super-user-command=sudo
$ cp ~/.config/kdesurc ~/.kde4/share/config/
$ sudo updatedb
Password:
$ locate kdesurc
/home/fitzcarraldo/.config/kdesurc
/home/fitzcarraldo/.kde4/share/config/kdesurc
$ diff ~/.config/kdesurc ~/.kde4/share/config/kdesurc
$ kwriteconfig5 --file kdesurc --group super-user-command --key super-user-command sudo

Figure that one out!
_________________
Clevo W230SS: amd64, OpenRC, nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64, OpenRC, xf86-video-ati, dual booting with Win 7 Pro 64-bit.
KDE on both laptops.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4950
Location: Dark side of the mood

PostPosted: Wed Jul 04, 2018 4:53 pm    Post subject: Reply with quote

Hi Fitzcarraldo.

Thanks for your insights. Now kdesu asks for my credentials, which is a plus and what I wanted 8) . To be sure I have created a hard link to kdesurc from .kde4/share/config like you did, (didn't realize about that one!) .config/ and .config/kde.org/ . That said, as you noticed, kwriteconfig5 saves kdesurc in .config/ . Go figure indeed!

However the "system" still asks for root password, e.g. when I want to change my user picture (clicking the picture from the application launcher menu). There are also other options which require root password but I'm almost certain this requires tweaking policy kit... which I'm not an expert at, unfortunately. I [think I] know somewhere it works with pkexec and [I assume] the latter can be driven to use kdesu.

Almost there. One step at a time ;-) ...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


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

PostPosted: Wed Jul 04, 2018 6:42 pm    Post subject: Reply with quote

If your user account is a member of the wheel group, create the file /etc/polkit-1/rules.d/10-admin.rules containing the following, then reboot:

Code:
polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});

Thereafter you will be prompted for your user account password instead of the root user's password when you want to change your user's avatar or whatever.

Ref. https://wiki.gentoo.org/wiki/Polkit#Rules
_________________
Clevo W230SS: amd64, OpenRC, nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64, OpenRC, xf86-video-ati, dual booting with Win 7 Pro 64-bit.
KDE on both laptops.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


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

PostPosted: Thu Jul 05, 2018 1:29 am    Post subject: Reply with quote

VinzC,
IMO, this is still the best way for restoring the kdesu root GUI function in kde. Still works as of 7-4-18 and qt-5.11 and the newest kde packages for ~amd64.

https://forums.gentoo.org/viewtopic-t-1062580-highlight-.html

You can revert the patches that in their "wisdom" the kde devs used to deny users a normal root GUI with the great patches posted by Nsane457 on this thread.

Just putting them in their own folders in /etc/portage/patches/kde-apps/ and a little rebuilding works great.

For example, I use an alias in /home/wrc/.bashrc
Quote:
alias kdol="kdesu dbus-launch dolphin"

As user if I need root, I just type kdol in a terminal, and a dialog box pops up, type in my root password, and a root Dolphin instance pops up. and every child from there such as text files. etc., is also root.

The only reason or actual danger of running in a GUI root is if you don't know what you're doing (and what NOT to do) while you are root. On stand-alone desktop systems, it's very convenient. I'm not a fan of sudo on Gentoo systems, but do use it on other distros.
_________________
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.27-r6, gcc-8.2.0-r3 kernel-4.18.13-gentoo USE=experimental
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4950
Location: Dark side of the mood

PostPosted: Sun Jul 08, 2018 1:54 pm    Post subject: Reply with quote

@Fitzcarraldo

Thanks a lot again! It works — I remembered it was something simple but couldn't put my fingers on it :oops: . So thanks for refreshing my memory 8) .

Now I can set an avatar for my desktop account and am indeed prompted for my own account's password. The thing is I wonder why it is a privileged operation as I don't see the avatar from SDDM login page anyway! Why all the fuss? :?

wrc1944 wrote:
VinzC,
IMO, this is still the best way for restoring the kdesu root GUI function in kde.

Well, I'm not quite sure what you call it "this" but I've read the thread you've linked to...

wrc1944 wrote:
https://forums.gentoo.org/viewtopic-t-1062580-highlight-.html

... and I think it's really sad — as I read, IIRC from Stallman, or was it the FSF, anyway — you can do stupid things with GNU/Linux as it won't stop you. Barring that feature denies the usefullness of learning, which is far more important than *not* doing stupid things — it's a catch-22, actually: how can you learn without doing mistakes? Better do nothing in fact as any cure will always be worse than the... problem, if you consider "not knowing" as a problem and "stop talking about it" the one and only solution!

There's an interesting topic on youtube about the same issue in networking and security.

Pushing the same "treatment" (aka down levelling) to everyone as if they were all... well, idiots (like "we know better"), isn't going anywhere but right into the wall. Alas I also see a trend here... not liking that either.

wrc1944 wrote:
The only reason or actual danger of running in a GUI root is if you don't know what you're doing (and what NOT to do) while you are root. On stand-alone desktop systems, it's very convenient. I'm not a fan of sudo on Gentoo systems, but do use it on other distros.

The sudo in question is of use to me only because I decided not to set any password to root. But that's an interesting topic: I've made my mind basically for security reasons but also because by experience it's become pointless to maintain a password for "root" while I can do all of my administrative tasks from my main account, which is part of group wheel — not talking about GUI tasks here. That spares me the hassle of having to remember (i.e. forget) one more password for "root" on all my GNU/Linux installations.

As for a security standpoint, I'm however curious to know if [no country password for old root man] makes sense. I guess in some circumstances attacks on root don't all relly on knowing the said password but I'm curious...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
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
Page 1 of 1

 
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