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!!
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.
I think I may have a newer version of
kate
installed. I'm running 18.04 and I get the following message:so it seems you can edit files as root by using the following command:
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
usingsudoedit
.You can easily set an alias for
sudokate
by adding the following line to your~/.bashrc
file:Then, run the following command to source your
~/.bashrc
file: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