LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-28-2009, 12:50 PM   #1
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Rep: Reputation: 15
tightvnc - vncserver at startup?


I'm running a linux host that I'd like to be able to log in using vnc. I cannot find any instructions the show how to log in remotely without either:
1) having a session already started on the host machine or
2) logging in through port forwarding using ssh.

Is it possible to have a vncserver start at boot and accept incoming connections for users without using either of the above two methods?

Regards,
Kurt
 
Old 07-28-2009, 01:15 PM   #2
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Quote:
Is it possible to have a vncserver start at boot and accept incoming connections for users without using either of the above two methods?
Of course
See here

Rather than using vnc, you might like to take a look at nx
 
Old 07-28-2009, 05:43 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If this is on a lan and security isn't an issue, you could use xdcmp logins. If over the internet, you could use a VPN tunnel.
 
Old 07-29-2009, 08:41 AM   #4
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
Thanks for the info,
If I use:
su - tred -c " cd /home/tred && vncserver :1 -geometry 1024x768 -depth 24"
1. is there a way to tell if it's running, and
2. is there a way to tell which port it is using?

Regards,
kurt
 
Old 07-29-2009, 08:43 AM   #5
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
Can nx leave a session open that I can reconnect to at a later time?
 
Old 07-29-2009, 09:14 AM   #6
geek745
Member
 
Registered: Jul 2004
Location: Boston, MA
Distribution: Slackware; Ubuntu; Slax
Posts: 172
Blog Entries: 2

Rep: Reputation: 33
Quote:
1. is there a way to tell if it's running, and
2. is there a way to tell which port it is using?
you should be able to tell if it's running by connecting to it as you plan to. VNC uses TCP port 5900 unless you have configured it otherwise. You can also check the process table for it with
Code:
ps ax | grep vncserver
and you can check connections to it with
Code:
netstat -nt | grep 5900
 
Old 07-29-2009, 10:22 AM   #7
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Quote:
Can nx leave a session open that I can reconnect to at a later time?
I expect so, I haven't used nx yet (too lazy to install it when vnc is working) but it has repeatedly been recommended as "better" than vnc.

Possibly the best thing for you to do is stop asking hypothetical questions and worrying, and just install either vnc or nx or both.
 
Old 07-29-2009, 10:24 AM   #8
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
I was able to ps aux | grep vnc to see it was running.

I also had to set up a password using vncpasswd.

Finally, I figured out that it was on port 5901 using the log file in my .vnc directory.

I

Unfortunately, despite adding startkde & to my xstartup, I just get a gray screen. I tried a local log in, and that shows a gray screen as well (vncviewer localhost:1). Any advice on what I might be doing wrong? Here's the output of my xstartup in .vnc:
Code:
$ cat .vnc/xstartup

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
#/etc/X11/Xsession
startkde &
Kurt

Last edited by petersk; 07-29-2009 at 11:33 AM.
 
Old 07-29-2009, 10:34 AM   #9
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Quote:
Finally, I figured out that it was on port 5901 using the log file in my .vnc directory.
Well done. Screen:0 is on port 5900 screen:1 is on 5901 etc (these are the defaults)
Quote:
Unfortunately, despite adding startkde & to my xstartup, I just get a gray screen.
That file looks OK to me, but do you realise that it needs to be on the host, not your local machine? Check the xtartup file on the pc you want to be able to access.
 
Old 07-29-2009, 10:36 AM   #10
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
Yes, that's on the remote machine. Should Xsession be commented out -- it seemed to make no difference between commenting it out and not, regardless, So, I'm not sure what the problem is, although I'm using Kubuntu, and there's no /etc/vnc directory nor any /etc/vnc.conf
Kurt
 
Old 07-29-2009, 10:53 AM   #11
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
I'm running kubuntu (6.06 and 8.04)
On server:
Code:
tgar@server:~$ which vncviewer
/usr/bin/vncserver
tgar@server:~$ ls -l /usr/bin/vncserver
lrwxrwxrwx 1 root root 27 2006-11-06 16:05 /usr/bin/vncserver -> /etc/alternatives/vncserver
tgar@server:~$ ls -l /etc/alternatives/vncserver
lrwxrwxrwx 1 root root 23 2006-11-06 16:05 /etc/alternatives/vncserver -> /usr/bin/tightvncserver
tgar@server:~$
See what is happening?
There are several vnc's, and you can have them all installed, but the one which is used when you just call vncserver is the one pointed to in /etc/alternatives, in my case /usr/bin/tightvncserver

I have the following packages installed on server:
tightvncserver
vnc-common
xtightvncviewer


It works well.

Maybe you are using different packages ?
 
Old 07-29-2009, 10:58 AM   #12
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
A follow-up: don't forget to "kill" any extra vncservers before you start new ones, or you'll have no idea of what ports they are working on, and you may find yourself looking at a "bad" screen (maybe setup with an old config) when the "good" one is running well on the next port up.
Hope this makes sense.
 
Old 07-29-2009, 11:32 AM   #13
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
Thanks, but I've been doing a reboot after each configuration change try.
Code:
$ which vncviewer
/usr/bin/vncviewer
$ ls -l /usr/bin/vncserver
lrwxrwxrwx 1 root root 27 2009-07-28 11:23 /usr/bin/vncserver -> /etc/alternatives/vncserver
$ ls -lat /etc/alternatives/vncserver
lrwxrwxrwx 1 root root 23 2009-07-28 11:23 /etc/alternatives/vncserver -> /usr/bin/tightvncserver
$ ls -l /usr/bin/vncserver
lrwxrwxrwx 1 root root 27 2009-07-28 11:23 /usr/bin/vncserver -> /etc/alternatives/vncserver
Seems my configuration is the same as yours.
Kurt

Last edited by petersk; 07-29-2009 at 11:33 AM.
 
Old 07-29-2009, 11:52 AM   #14
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
I don't know what is happening here.

On your local PC try starting a vncserver and connecting to it locally. For me, it goes like this:
Code:
tred@vaio:~$ vncserver :1 -geometry 800x600 -depth 24 

New 'vaio:1 (tred)' desktop is vaio:1

Starting applications specified in /home/tred/.vnc/xstartup
Log file is /home/tred/.vnc/vaio:1.log
tred@vaio:~$ vncviewer localhost:1
VNC Viewer Free Edition 4.1.1 for X - built Apr 16 2008 13:02:40
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Wed Jul 29 17:46:36 2009
 CConn:       connected to host localhost port 5901
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8

Wed Jul 29 17:46:41 2009
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding
 CConn:       Throughput 20000 kbit/s - changing to hextile encoding
 CConn:       Throughput 20000 kbit/s - changing to full colour
 CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
 CConn:       Using hextile encoding
Does it work?
if not, please post your local ~/.vnc/xstartup and take a look at the log.
My xstartup just says
Code:
#!/bin/sh
startkde &
.. and please make sure xstartup has executable permissions.

No need to reboot (slow and boring):
Code:
tred@vaio:~/.vnc$ ps -Al | grep vnc
0 S  1005 14279     1  0  80   0 -  3380 -      pts/1    00:00:01 Xvnc
tred@vaio:~/.vnc$ kill 14279
tred@vaio:~/.vnc$
 
Old 07-29-2009, 12:02 PM   #15
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Original Poster
Rep: Reputation: 15
I tried changing my xstartup to just contain startkde &.

Code:

~/.vnc$ vncserver -kill :1
Killing Xtightvnc process ID 4268             
~/.vnc$ ps aux | grep vnc
   4344  0.0  0.0   3336   792 pts/1    R+   11:06   0:00 grep vnc
~/.vnc$ vncserver :1 -geometry 800x600 -depth 24

New 'X' desktop is E53A-EDA-DB:1

Starting applications specified in /home/kpeters/.vnc/xstartup
Log file is .vnc/E53A-EDA-DB:1.log

~/.vnc$ vncviewer localhost:1

VNC Viewer Free Edition 4.1.1 for X - built Apr 16 2008 13:02:40
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Wed Jul 29 11:07:08 2009
 CConn:       connected to host localhost port 5901
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8

Wed Jul 29 11:07:12 2009
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding
 CConn:       Throughput 20010 kbit/s - changing to hextile encoding
 CConn:       Throughput 20010 kbit/s - changing to full colour
 CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
 CConn:       Using hextile encoding
still a grey screen.. :-(

Code:
-rw-r--r--  1 kpeters kpeters 2814 2009-07-29 11:10 E53A-EDA-DB:1.log
drwxr-xr-x 51 kpeters kpeters 4096 2009-07-29 11:07 ..
drwx------  2 kpeters kpeters 4096 2009-07-29 11:07 .
-rw-r--r--  1 kpeters kpeters    5 2009-07-29 11:07 E53A-EDA-DB:1.pid
-rwxr-xr-x  1 kpeters kpeters   22 2009-07-29 11:06 xstartup
-rwxr-xr-x  1 kpeters kpeters  336 2009-07-29 11:06 xstartup.back
-rw-------  1 kpeters kpeters    8 2009-07-29 08:13 passwd

Last edited by petersk; 07-29-2009 at 12:04 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running vncserver at startup?? syntacticalerror Linux - Server 2 07-15-2008 09:08 AM
VNCServer on startup: What am I doing wrong? MikeOfAustin Linux - Software 10 05-30-2007 12:49 PM
vncserver on startup greenmeanie *BSD 1 10-22-2005 11:16 AM
how to startup the vncserver ust Linux - Distributions 2 05-25-2005 07:58 AM
Robust vncserver startup file (rc.vncserver) arobinson74 Slackware 4 05-14-2005 05:33 AM


All times are GMT -5. The time now is 11:05 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration