Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to use x11vnc to allow users to remote control certain computers. This works fine in general, but there is one aspect I have trouble implementing. I want to restrict access to a specific user account, but the user that the X11 session belongs to is a different one.

So the situation is:

  • User A is logged in at the computer
  • User B starts x11vnc and someone connects to it

The problem is that I can only start x11vnc as root or as the currently logged in user, it doesn't work as any other user. Is there any way to allow a specific user to access my X11 session?

share|improve this question
    
I believe x11vnc starts a desktop for the user that x11vnc starts under. Are you invoking the process as the user you want logged on, or is it setup to autostart? –  Tim Jul 30 '12 at 12:43
    
I start x11vnc as user B, while user A is currently logged in. I'm starting x11vnc manually from the shell, not automatically –  Mad Scientist Jul 30 '12 at 12:44

2 Answers 2

If your problem is that x11vnc can't even launch because it doesn't have access to the X session, you need to grant access to the other user with xhost +SI:localuser:other_username before starting x11vnc as the other user.

The title of the question makes it sound like you want to restrict access to the VNC server though.

share|improve this answer
    
It is likely xhost +otherusername will not do anything because the X server isn't listening to TCP connections. –  Gilles Jul 30 '12 at 22:25
    
and xhost + is for host names, not usernames –  Stéphane Chazelas Sep 28 '12 at 21:19
    
@sch: i fixed it –  Janus Troelsen Sep 28 '12 at 21:32
    
cool.Thanks. I learnt something new today thanks to you (si:localuser). It seems it's not even Linux specific. –  Stéphane Chazelas Sep 28 '12 at 21:46

X displays are protected by a "key" which you need to give in order to be able to connect. That key will generally be stored in the user's ~/.Xauthority file.

To allow someone else's application (like x11vnc) to connect to his DISPLAY, a user has to give him that key or grant him access to his ~/.Xauthority file. You can retrive the key of your display by doing.

xauth list "$DISPLAY"

You can grant access to your ~/.Xauthority by changing its permissions (group ownership or ACLs).

The other user can specify which authority file to use via the XAUTHORITY environment variable, or add a key to a specific display to his own ~/.Xauthority using xauth add.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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