I can't lock screen if I logged in as root.
To be exact:
Starting with standard XFCE configuration, right-click on Logout panel button. Choose "Properties". Change second button setting from "disabled" to "Lock screen". Close properties dialog. The panel button changes, now it has two small buttons, green one for logout and brownish one for screen locking.
Under non-root, screen locking works: a password window appears.
Under root, screen locking button does nothing.
I am not sure if graphical logins as root are supported, there are numerous reasons we disable it in the different login managers.
Can you please check
1. if xscreeensaver is running when you are logged in as root
2. if 'xscreensaver-command -lock' works or if there is an error message on the terminal
So, either just set it to save the screen, but not lock, or just don't login as root.
No protocol specified
xscreensaver: 18:14:05: Can't open display: :0.0
xscreensaver: 18:14:05: initial effective uid/gid was root/root (0/0)
xscreensaver: 18:14:05: running as nobody/nobody (99/99)
xscreensaver: 18:14:05: This is probably because you're logging in as root. You
shouldn't log in as root: you should log in as a normal user,
and then `su' as needed. If you insist on logging in as
root, you will have to turn off X's security features before
xscreensaver will work.
Please read the manual and FAQ for more information:
I read the links provided, and I see that the reason is, as expected, that someone (in this case, xscreensaver developer) is trying to shove his paranoid ideas about security down other people's throats.
It's not up to programs to make policy decisions.
"Don't run X as root" is a policy decision.
It's *my* computer, and *my* data. It's up to *me* to decide whether to run X under root, and take the risk of someone hacking my computer through X vulnerabilities.
IOW: xscreensaver should not do any "if uid==0, then switch to nobody" tricks.
If they do feel strongly about it, by all means, emit a warning to stderr or syslog, but don't intentionally handicap your program.
Moving to xscreensaver, since this really has nothing to do with xfce4-panel.
Upstream has a strong opinion on this matter. I suppose you're welcome to fork xscreensaver and make your own project that doesn't impose this requirement.
Software design. Closing.
If you want to make screensaver (not only xscreensaver but also gnome-screensaver  ) lock screen, please contact the upstream directly. I won't
change the current behavior without upstream's decision.