10

I'm using Kubuntu 18.04 and I want to run the kate editor with root privileges sudo kate produces the message running kate as root is not possible. I think that's utterly silly. How can I bypass it?

Answer: just edit the file, even if it's a system file, using plain oldkate. You don't need root privileges to edit it; you only need root privileges to save it. When you save a system file, you'll be asked for the root password. Supply it and the save takes place. Easy!!

Paul A.
  • 2,241

3 Answers3

11

I think I may have a newer version of kate installed. I'm running 18.04 and I get the following message:

Executing Kate as root is not possible. To edit files as root use:
SUDO_EDITOR=kate sudoedit <file>

so it seems you can edit files as root by using the following command:

SUDO_EDITOR=kate sudoedit <file>

However, you won't be able to edit files as root in any directory that is not owned by root. Because of this, you must also specify a filename when you run kate using sudoedit.


You can easily set an alias for sudokate by adding the following line to your ~/.bashrc file:

alias sudokate='SUDO_EDITOR=kate sudoedit'

Then, run the following command to source your ~/.bashrc file:

source ~/.bashrc

Also, don't forget to source your ~/.bashrc file in all other open terminals to apply the changes.

Now, you can run the sudokate command to edit files in directories owned by root.


SOURCE

mchid
  • 44,904
  • 8
  • 102
  • 162
10

You can edit system files with Kate 19.04.3 (available in Kubuntu 19.10) or in Kubuntu 19.04 (with kubuntu-backports ppa) installed.

Simply open the file you wish to edit in Kate, edit it, and click Ctrl+S. A PolicyKit window will appear prompting you for your password. Provide it and click Okay.

editing system files in Kate

DK Bose
  • 44,553
0

You can run Kate as root by access the file you want to open in Dolphin, then right click and "Open as Administrator".

Open text file as administrator

It will then prompt you to enter the root password and open a new Dolphin window as the administrator. Then you can access any file as root in Kate.