1

Sudo works only with some of my applications. For example sudo vi or sudo gedit works, but sudo atom returns an error

No protocol specified

I tried to follow steps from another stackoverflow question but:

  • visudo -f /etc/sudoers returns "Permission denied".
  • I don't have any .Xauthority file in $HOME nor I have any $XAUTHORITY set.

(I am using fedora.)

Ford O.
  • 171
  • login as root, then visudo -f /etc/sudoers – Michael D. Nov 05 '16 at 10:09
  • What is atom? It's not installed on my system. Can you link to a distro repository page or the project's web site? Based on the very limited information you have provided, I suspect it requires additional command-line parameters, which you are not providing. This is not likely to be a sudo issue, but rather an atom (whatever that is) issue. – user Nov 05 '16 at 12:15
  • @MichaelKjörling Atom is an IDE (https://atom.io) – Ford O. Nov 05 '16 at 12:57

2 Answers2

3

Newer systems by design don't allow graphical applications as root (it's a Wayland thing). Workaround:

xhost si:localuser:root

sudo   your-graphical-app

Restore the default permissions:

xhost -si:localuser:root
kubanczyk
  • 1,258
  • 9
  • 19
1

I got this error because I'm running Fedora with Wayland, which apparently doesn't support running applications under a different user (https://bbs.archlinux.org/viewtopic.php?pid=1680591#p1680591).

However, you can easily achieve what you want (editing a file that is owned by root) with the following command:

atom admin://path/to/file

In other words: just prepend admin:// to a path that needs root privileges.

Then again, this might not work for you as gedit seems to do fine. (In my case it failed too.)

c0d0g3n
  • 11
  • 3