0
~$ sudo gedit /etc/fstab
Authorization required, but no authorization protocol specified

(gedit:12281): Gtk-WARNING **: 18:04:28.708: cannot open display: :0
Kent
  • 11

1 Answers1

0

Running graphical applications through sudo is possible but is messy at best. Instead of trying to run gedit directly with sudo, try this:

EDITOR=gedit sudoedit /etc/fstab

This will make a copy of the file you can edit in your account, run the editor (gedit) in your account on that file, and then as root copy the file back to the original location. This greatly simplifies making graphical applications work over running them directly with sudo.

The alternative, as you mentioned in your comments, is to run a non-graphical editor (such as vi or nano) with sudo. But you could use sudo edit with those too, which has some advantages, such as using your account's editor config files instead of the config files in root's account.

user10489
  • 5,533