LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 12-20-2014, 06:07 PM   #1
linux_walt
Member
 
Registered: Dec 2014
Location: Houston, TX
Distribution: Debian wheezy
Posts: 127

Rep: Reputation: 29
Remote desktop using tightvncserver


Hello, I have a small Linux box (cubieboard2) on my desk, connected to an HDMI monitor. It has some version of Lubuntu/Linaro, and it's use has been mostly limited to playing movies, while I work on my windows xp laptop.

A couple of days ago I decided to learn LaTex, and installed it in my Linux box. The idea was to work on LaTex, or anything else for that matter, remotely from my windows pc, while the linux box was also playing a movie on its attached screen.

I tried x11vnc, but I could only get it to display, on the local pc screen, the same image that was being displayed on the monitor attached to the Linux box.

Made a breakthrough today, switching to TightVnc. For a newbe this turned out to be the way to go, extremely simple (still took hours, but it finally worked). It turns out that the TightVnc server will create a separate display from the one that is currently running on the attached monitor.

Caution, the following is from someone new to Linux.

On the remote Linux machine

Code:
sudo apt-get install tightvncserver
Since you will be creating a new display, make sure its number doesn't conflict with the current display. In a terminal window type

Code:
$ echo $DISPLAY
:0
In this case my current display is '0'. Now you can run the vncserver giving it a different number (*):

Code:
$ vncserver :1
Starting applications specified in /home/walter/.vnc/xstartup
Log file is /home/walter/.vnc/cubieboard2:1.log
The first time you run this command it will ask you for a password. In my case I received an error that it could not access my password file. If I remember right, the file it's referring to is ~/.vnc/passwd . In my case, it had been created with ownership root:root . Changing this to <your username>:<your username> should fix it.

Note the log file it creates: <computername>:1.log . In here you will find any errors that might have happened during startup. It also tells you which port number it will be listening to, which should be 5901 (5900 + display#). You will need this port number information when you connect from the remote machine, as well as the network address and password (selected above).

To find out your Linux machines network address you can use this command:

Code:
~$ ifconfig
My address was listed under 'eth0'->inet addr:xxx.xxx.xxx.xxx

(*) It's not really necessary to tell vncserver the display number you want to use. It will select one for you that is available. However, if you are going to kill it after you are done, it's probably safer to know for sure which display you are killing.

On the local Windows machine
Install TightVnc viewer. When you start it up, you will need to enter the Linux box's address, and the port to connect to:

xxx.xxx.xxx.xxx::5901

Hit 'connect' and it should then ask you for the password.

Now, if you have the same luck as me, it won't be quite that simple. You are viewing the remote's display #1, not the movie playing on the remote's screen, however your window is a large gray box, with nothing in it except an over-sized cursor. Ok, it's a step forward.

Back on the remote Linux machine
In your home directory, under .vnc, there is a vncserver start-up configuration file called xstartup. Adding this line to it, at the bottom, made everything work (as far as I can tell):

Code:
exec ck-launch-session lxsession -s Lubuntu -e LXDE
I then commented out one line at a time, rechecking if everything was working, and ended up with the above as the only line in the file. This also got rid of a few errors, reported in the log file

.vnc/cubieboard2:1.log

That's about it, almost. When you close the vnc viewer, on your windows machine,
the server on the linux machine keeps running. To stop it, type this command:

Code:
vncserver -kill :1
(or whatever display number was used to start it).


Some discoveries

It turns out that vncserver is only a script for starting the real program: Xvnc.
You can view the script if you type:

Code:
~$ cat /usr/bin/vncserver

Further work to do
In the reference from 'penguintutor', there is a section 'Adding Tightvnc to the startup'. From here I hope to get the information on how to automatically have vncserver kill itself when the remote window is closed. I'd prefer that it not be running all the time.

Links

http://www.penguintutor.com/linux/tightvnc

The Windows client viewer. Note this seems to also install the server on your Windows machine, which you don't need:
http://www.tightvnc.com/download.php

http://www.tightvnc.com/Xvnc.1.php



The following is just rambling and not very relevant
====================================================

It's amazing what a little linux board can do. It only has 1Gig ram! I added a 500gb hard drive, but still. It plays movies, while serving a completely different monitor output, and you are working on a document on it at the same time. All without a glitch.

I'm also wondering if this isn't a great way to get a group of people to transition from Windows to Linux. I have no way of trying this, but if it's possible to create as many working vncservers as you want on a Linux machine, each person in a group could connect to their own account, have their own remote desktop, and be able to practice using Linux software without ever leaving their Windows environment. They could incrementally start moving their files to the Linux server, experiment with new programs that could substitute for what they are currently using, and slowly transition to Linux, instead of all at once.

That is about what I am doing, although I feel a bit bad about it. XP has been great. Except for the last year or so, while it was supported, the security updates were crippling it. They had to be uninstalled, leaving the computer vulnerable.

Last edited by linux_walt; 12-24-2014 at 12:25 PM. Reason: Fix incorrect reference
 
Old 01-12-2015, 11:54 PM   #2
linux_walt
Member
 
Registered: Dec 2014
Location: Houston, TX
Distribution: Debian wheezy
Posts: 127

Original Poster
Rep: Reputation: 29
Have since changed from Ubuntu to Debian, and again had to figure out how the vncserver configuration file (~/.vnc/xstartup) should be set up.

This time I only have:
Display manager: lightdm
Window manager: openbox
Taskbar: tint2

New xstartup file:
Code:
autocutsel -fork
exec ck-launch-session  openbox-session
The entry 'autocutsel' starts a program that will let you cut and paste, from your windows desktop, into the xvncserver window. Very handy: apt-get install autocutsel


PS To get tint2 taskbar to appear, I needed to create this file:
Code:
~/.config/openbox/autostart.sh
then add this line:
Code:
(sleep 2s && tint2) &
 
Old 06-23-2016, 03:12 PM   #3
biosboy4
Member
 
Registered: Aug 2015
Distribution: Debian, SUSE, NXOS
Posts: 242

Rep: Reputation: 38
I hope you're using vnc over a lan behind a firewall/NAT. There are tons of haks out there for vnc and a public facing vnc port will get you owned., it's just a matter of time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problem with tightvncserver explorer Debian 2 09-02-2012 09:59 AM
Installing a linux-distro remote desktop on an already remote debian server... errr? Sabinou Linux - Newbie 2 04-26-2012 05:29 PM
SSH shell disabled + Remote desktop NX (or another remote desktop software) zoltan32 Linux - Software 2 04-12-2011 03:36 AM
Cross-platform remote control / remote desktop software trafikpolisen Linux - Software 5 01-24-2010 12:27 AM
Scripting Remote Logon - Starting Remote Gnome Desktop klmukp Linux - Newbie 1 09-21-2008 12:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 01:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration