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 am trying to set up some automation scripts to set up a Linux environment. I would like to enable remote desktop sharing without the user having to actually use the GUI to do so. My plan is to write a batch script that maybe edits some file to do this automatically, if possible.

I am using Fedora 16 with the Gnome.

I want to achieve the following: http://docs.fedoraproject.org/en-US/Fedora/13/html/User_Guide/chap-User_Guide-Sharing_your_desktop.html

Any tips on what file to edit would be greatly appreciated.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

If I understand you right: you want to share gnome or other environment remotely as it is, then the easiest way to achieve this is to use x11vnc. It shares real X11 server as it is after user logged in:

x11vnc -display :0

Or if you want vnc server run after login, you can automate with this script:

#!/bin/bash
/usr/bin/x11vnc -nap -wait 50 -noxdamage -passwd PASSWORD -display :0 -forever -o /var/log/x11vnc.log -bg

You can place this script in startup programs in gnome, so that it could be run automatically when the user logins. Please note that this script is not secure as session PASSWORD variable is clearly seen to anyone who could read the file and anyone knowing password can connect to vnc session (password in this case is 8 symbols word asked when you are connecting remotely). If you want more secure connection search how to do vnc ssh tunneling.

share|improve this answer
    
Any idea how to get that running on GDM in case the machine isn't already logged in? –  LVLAaron Apr 20 '13 at 19:33
    
You can do that too: x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth –  IBr Apr 20 '13 at 20:24
    
Is there a way to do this just once without placing any scripts in startup? When I enable desktop sharing, I only have to do it once after I am setting up the machine. That would be great. Thanks! –  M S Apr 21 '13 at 5:52
    
Connect with ssh to pc you want and just run x11vnc from terminal if you are already logged in (for example after setup your PC restarted and you got autologin, then you could run ssh to connect to it type in terminal x11vnc -display :0 and you are free to connect with any client you want. Or either you can connect with ssh at any time and run x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth to connect directly to gdm login screen). After you're done, you can stop x11vnc and disconnect from ssh. –  IBr Apr 21 '13 at 6:13
    
Thanks for all your help IBr! –  M S Apr 21 '13 at 6:19
add comment

My favorite method for remote connections is to use vino. It's similar to x11vnc, but I find it much easier to set up (though I'm typically using a GUI). With Vino enabled, gnome is set up to accept vnc connections for the active session (the one that is currently logged in), for every boot. Any windows or applications open on the screen will be viewable in the vnc connection.

In normal cases (e.g., through a GUI), it's enough to set it up by running

$ vino-preferences

In the absence of a GUI, the settings must be changed using gsettings. Something like

$ gsettings set org.gnome.Vino enabled true
$ gsettings set org.gnome.Vino view-only true
$ gsettings set org.gnome.Vino authentication-methods "['vnc']"
$ gsettings set org.gnome.Vino prompt-enabled false
$ gsettings set org.gnome.Vino require-encryption true

would enable remote desktop with sane values. You can see the full list of options as well as a description of their effects by opening dconf-editor and navigating to desktop.gnome.remote-access.

If your computer has multiple users, Vino will need to be set up for each user.


To connect to your remote session, you can use any standard vnc client. However, you must forward port 5900 to the computer you want to connect to from your router's firmware. Alternatively, if you are also allowing for ssh connections to these computers, it may be easier and more secure to use vnc through an ssh tunnel. From your local machine:

ssh -L 5900:localhost:5900 <remote server>

Then open up a vnc client and connect to 127.0.0.1:5900 and log in with your remote server's username and password.

share|improve this answer
    
Unlike the x11vnc answers, this is how to get remote access to the :0 that you left at work. Now that wasn't the OP's question, but it was mine, so thanks! –  user18096 Apr 16 at 3:11
add comment

If I need access to my desktop I generally just SSH in and run "x11vnc" and then connect w/ VNC.

share|improve this answer
add comment

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.