Ive tried using sudo gedit <filename>
but the terminal spits out "The owner of /home/user/.config/ibus/bus is not root!" as it opens gedit. Then when I try to save from gedit it comes up with an error at the top saying "could not save the file
Unexpected error: Error writing to file: input/output error"
Asked
Active
Viewed 393 times
2

Daniel
- 21
-
1You may find this informative: Why should users never use normal sudo to start graphical applications? – steeldriver Jul 22 '19 at 13:52
-
2You might want to see also http://www.webupd8.org/2015/03/how-to-run-gedit-and-nautilus-as-root.html, if applicable to your system. – Bodo Jul 22 '19 at 14:08
1 Answers
1
The simplest solution is to use sudoedit or sudo -e after adding your username to the newsudo group w/ sudo usermod -a -G newsudo yourusername
.
The classic answer you will find all over the web is to use gksudo or gksu to open a graphical editor, such as gedit. However, gksudo and gksu are depreciated and no longer included with Debian and its derivatives, such as Ubuntu and Mint, as noted by ItsFOSS and the previous web link.
Nautilus Admin or PolicyKit can be used, as Bodo kindly noted above in Comments, if you are adamant you must have a graphical editor.

K7AAY
- 3,816
- 4
- 23
- 39
-
I used
sudo nano <filename>
and when it opened it showed that the document is blank. I copied the short file into the editor and made my changes, then when I went to save "[ Error writing: Permission denied ]" popped up on the bottom of the screen. – Daniel Jul 22 '19 at 21:13 -
Hm, I can edit other files in the same directory(which are also read only), but for some reason the one file I want to edit won't open properly in nano. – Daniel Jul 22 '19 at 21:14
-
@Daniel I suggest to show the command
ls -l <filename>
with its output in your question. – Bodo Jul 23 '19 at 09:41 -
1Please don’t suggest running an editor as root, it’s better to use
sudoedit
— and it can be set up to use a graphical editor, without requiring PolicyKit configuration. – Stephen Kitt Jul 23 '19 at 13:14 -