2

I am using KDE and Kate editor. When I want to edit some common system files such as configs in /etc, I am asked for password to save my edits.

When I am editing files, I often do several changes, then want to save file and continue to do changes. The problem is that after first file save, permission is not "cached". I need to reenter the my password for EVERY change! This is very annoying.

Some time ago I had a configuration when I could enter password just once, then I could edit and save file without any additional password dialog. But it was several years ago, so I do not know if this was changed in source code or it was configured specifically in the system.

Now I cannot find instructions regarding this. Is it possible to get such behavior again? I have found this topic, but it looks like they just disable password protection completely.

1
1

I have found a workaround that still allows you to start kate as root.

First, copy the original kate desktop file to your user's local location:

cp /usr/share/applications/org.kde.kate.desktop ~/.local/share/applications/org.kde.kate_as_root.desktop

Then replace Exec=kate -b %U with the following:

Exec=if [ "$XDG_SESSION_TYPE" = "wayland" ]; then xhost +si:localuser:root && pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch kate -b %U && xhost -si:localuser:root ; else pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate -b %U; fi;

And set the Name to "Kate as root" for your convenience. Also, change InitialPreference from 9 to lower value (in my case 8), so that open as root variant become less priority than opening as normal action, so when you left click on a file, it opens as normal.

My content of the ~/.local/share/applications/org.kde.kate_as_root.desktop file is (excluding translations):

[Desktop Entry]
GenericName=Advanced Text Editor
Name=Kate as root
Comment=KDE Advanced Text Editor
MimeType=text/plain;
Exec=if [ "$XDG_SESSION_TYPE" = "wayland" ]; then xhost +si:localuser:root && pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch kate -b %U && xhost -si:localuser:root ; else pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true kate -b %U; fi;
StartupNotify=true
X-KDE-HasTempFileOption=true
Icon=kate
X-DocPath=kate/index.html
Type=Application
Terminal=false
InitialPreference=8
X-DBUS-StartupType=Multi
X-DBUS-ServiceName=org.kde.kate
Categories=Qt;KDE;Utility;TextEditor;
StartupWMClass=kate

Now in kate when you are at situation of editing file without permissions, you can go to File -> Open in -> "Kate as root". In the dialog you enter password, and you get the new kate window in which you do not need to enter password anymore.

Additionally, you can right click on a file in dolphin and choose Open with -> Kate as root.

0

Kate was changed to require the password after every save operation rather than remembering it for five minutes as it used to.

2
  • Are there any code references? Do you know the reason of that? Was that thing done intentionally?
    – Ashark
    Mar 29 at 7:31
  • I can't find the commit right now, but I know it was done deliberately in the name of security.
    – iLikeDirt
    Mar 30 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.