Search code examples
linuxx11vncvnc-servervnc-viewer

Prevent users from sending windows(xterm, gvim, ..) to my VNC display


VNC allows any user to send their windows like xterm, gvim, .. to any other user's VNC, using -display option of command or by setting my VNC display in DISPLAY variable.

Some users exploiting this feature and keep on sending xterms to my VNC. Is there any way where I can completely disable or selective allow other users?

My viewer details:

VNC Viewer 5.2.1 (r5668) 32-bit(Aug 18 2014 12:58:45) from RealVNC

I am looking for some options provided by this viewer/other to achieve this


Solution

  • The command you're looking for is xhost. xhost allows you to control access to your X environment and $DISPLAY. In your case, the default is probably "no access control" or xhost +.

    By specifying xhost - you will disallow everyone (excluding yourself) access to your current $DISPLAY. Other users won't be able to run commands on your $DISPLAY anymore.

    You can selectively add (or remove) users and/or machines from the access list, with xhost +si:localuser:username or xhost +otherhost. For more information on the si: syntax, please see the Xsecurity manual.