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.)

  • login as root, then visudo -f /etc/sudoers – Michael D. Nov 5 '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. – a CVn Nov 5 '16 at 12:15
  • @MichaelKjörling Atom is an IDE (atom.io) – Ford O. Nov 5 '16 at 12:57

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

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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.