Skip to main content
Topic: kate save as root (Read 930 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

kate save as root

I noticed that on the Plasma live cd the ability is there to edit root owned files and then when saving enter the root password.
I pretty sure Policykit is involved but looking at the livecd and searching I can't figure out how it's implemented ?
It isn't working like that on my install migrated from Arch / Plasma.

Can anyone tell me how it's done, what I need to do ?

Re: kate save as root

Reply #1
I sort of knew that polkit had something to do with this but its not something I've ever checked out.
polkitd is running.
polkit            polkit-kde-agent  polkit-qt5  are installed.
Code: [Select]
org.kde.ktexteditor.katetextbuffer.savefile:
  description:       Save Document
  message:           Root privileges are needed to save this document
  vendor:            Document Actions
  vendor_url:       
  icon:             
  implicit any:      no
  implicit inactive: no
  implicit active:   auth_admin

Try to save a root owned file in kate and I just get a beep and
Quote
The document could not be saved, as it was not possible to write to /etc/bash/bashrc.d/local.bashrc.
Check that you have write access to this file or that enough disk space is available.
The original file may be lost or damaged. Don't quit the application until the file is successfully written.

I can run kate as root. But I'm trying to do things the 'modern' way.
Stuck for now though.

Oh and I've checked for messages with dbus-monitor but nothing when I attempt the save




Re: kate save as root

Reply #2
 
Well I know what's not working now.

/usr/lib/polkit-kde-authentication-agent-1
fails to run
Quote
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-lee'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-lee'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-lee'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-lee'
New PolkitAgentListener  0x557049714200
Adding new listener  PolkitQt1::Agent::Listener(0x557049761770) for  0x557049714200
Listener online
"Cannot register authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject"
Authentication agent result: false
Couldn't register listener!

Turned on polkit debug logging but that's not giving me many ideas.
Tried enabling sddm but it's all the same ( I usually just 'startx')

gdbus monitor --system --dest org.freedesktop.PolicyKit1
has no output whan I run
/usr/lib/polkit-kde-authentication-agent-1

https://github.com/elogind/elogind/issues/160
suggests it's a pam issue but the fix suggested there does not apply as there's no reference to systemd in any of the pam files.

I keep digging....

 

Re: kate save as root

Reply #3
Well I've got it working.
Whether I've done it in the right way is very debatable.

On a hunch I added
Code: [Select]
session    optional                    pam_elogind.so
to the end of
/etc/pam.d/system-auth

I do not properly (or even hardly) understand pam
And the file is not like that in the Plasma-openrc Artix VM I'd created to try and compare.
So it must be fixable elsewhere as well ?
I am not marking this solved yet as I hoping that if I've introduced a security hole someone that understands pam might see this and let me know.