Xclip: Authorization required, but no authorization protocol specified

When I try to use xclip, I get this error:

Authorization required, but no authorization protocol specified

Error: Can’t open display: :0

My x11 configuration is:

services.xserver.enable = true;
services.xserver.displayManager.startx.enable = true;

In a gnome xorg session.

The error only shows up when I use xclip with sudo or as root. Then it keeps coming up even when I revert back to the user

Anyone would be able to help?

2 Likes