LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-10-2004, 06:29 PM   #1
azzurro
Member
 
Registered: May 2004
Posts: 39

Rep: Reputation: 15
VNC Session Handling


Hi all,

I have successfully set up TightVNC on my Slackware 10 server an am able to connect without difficulty from my WinXP laptop.

What I am really curious about is how "sessions" (I do not know if I am using the right terminology) are handled.

I will try and explain. I boot up my Slackware server and start up the vnc server without starting x. I connect from my WinXP laptop and Gnome appears on the screen of my laptop. I start doing things. For example, use Azureus and get some torrents. But if I disconnect from within the TightVNC Viewer on my laptop, I lose everything. It seems to me like Azureus exits and so does everything else that I was doing.

Is there any way to modify this behaviour, such that sessions are "kept alive" even after disconnection, so that, upon reconnection, everything is as I left it, only with the torrents done downloading?

I really liked the behaviour of remote desktop between on WindowsXP... I realize that the beauty of VNC is that it is possible to log-in from different locations and have a brand new desktop presented, but this, unfortunately, is not useful to me unless I can choose to keep sessions open. Also, it seems like it is only possible to run Gnome once (at a time - is this true?), so even with multiple log-ins, this is not very useful to me when you can just ssh.

Is there any way to modify VNC to achieve the behaviour I want, or use a different tool?

Thanks
 
Old 08-10-2004, 10:10 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
How is it you are disconnecting? I've used VNC many times, and haven't had this problem. However, I use the vnc server and viewer provided from Real VNC. All I simply do is close the viewer widow with the "x" button in the window border. If you were to choose "logout", "shutdown", or any other option within the VNC window, then that's the problem. You'd be telling the vnc server to exit the X windows environment completely (and kill any processes spawned in X windows).

As for running multiple Gnome sessions simultaneously, yes you can. There is an environment variable you need to "unset" when you start up a VNC session when there is another session running for the same user. Add this to your ~/.vnc/xstartup file:
unset SESSION_MANAGER
 
Old 08-11-2004, 04:59 PM   #3
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Hmm... I can actually re-connect to the same session after-all. I think that maybe I was hallucinating at the time

I still can't seem to run multiple Gnome sessions though. If I start the vncserver, startx from the actual server, and then attempt to connect from another computer, I get a grey screen and the mouse pointer that looks like an X on the vnc client. I have not tried connecting from two different (non-server) clients though. Should I try, or does this behaviour mean that something is not working right?

Here is my xstartup:

Code:
#!/bin/sh

xrdb $HOME/.Xresources
/usr/bin/gnome-session &
unset SESSION_MANAGER
I must add that this functionality is not a big deal to me now that I can "resume" sessions. It would be nice, but not essential.

Thanks for your help!
 
Old 08-11-2004, 05:20 PM   #4
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
One more question:

This is an option within TightVNC, but RealVNC is probably the same.

The last thing that I want to do is make sure my VNC sessions are safe from prying eyes and that my own server is secure from any outside attempts to gain entry through the port that VNC needs open. I'm going to tunnel through SSH and use the following option:

Code:
-localhost
    Only allow loopback connections from localhost. This option is useful in conjunction with SSH tunneling.
Now, no one will be able to connect unless they are on connected to my machine, correct?

My question is not how to tunnel (there's plenty of information available on that topic)... I have another "session" question

Code:
-rfbwait time
    Maximum time, in milliseconds, to wait for an RFB client (VNC viewer).
I should not use this option, correct? If the VNC server times out waiting for a connection, does that mean I lose my entire X seesion? This option is enable by default in the startup script, so I need to know whether to comment it out.

Thanks again

Last edited by azzurro; 08-11-2004 at 05:22 PM.
 
Old 08-11-2004, 07:41 PM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally posted by azzurro
Here is my xstartup:

Code:
#!/bin/sh

xrdb $HOME/.Xresources
/usr/bin/gnome-session &
unset SESSION_MANAGER
The "unset" line should come before the gnome-session line, but I don't think that's the core of the problem. What are the permissions on your xstartup file? You need the execute permission to be set. I came across a grey screen like you describe in the past, but it's been a while since I fiddled with it; not positive what all I did to fixed it.

To be honest, I haven't used those options before, but the -localhost option looks to be a winner. However, if you can access it remotely (via an SSH tunnel), then so can someone else. It's much, much more difficult for them, but theoretically the chance still exists.

I wouldn't use the -rfbwait option. I don't know if that's just the time for initial connection or if it includes time between a disconnect and a reconnect. Besides, with the -localhost and the SSH tunneling, I think you're reasonably safe.
 
Old 08-15-2004, 11:34 AM   #6
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
I moved the unset line and now multiple gnome sessions run without difficulty. Thanks so much!

In terms of security, I figure that if someone can ssh into my box without my consent, then them being able to launch a gnome session is the least of my concerns

The -localhost option is giving me trouble... when I use the option and try to tunnel, the vnc viewer simply disappears after hitting connect. I have no problems tunneling when the server is not started with the -localhost option. Any ideas?
 
Old 08-15-2004, 03:32 PM   #7
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I wish I had some fascinating insight regarding the -localhost option, but that's unexplored territory for me. I would have assumed that ssh port-forwarding would make the connection appear as if it's coming from the local host. Maybe someone that comes across this can shed some light on why this isn't the case, or if there's some other configuration that needs to be tweaked.
 
Old 09-05-2004, 08:59 PM   #8
netindustries
LQ Newbie
 
Registered: Mar 2004
Location: Indianapolis
Distribution: Slackware 9.1
Posts: 25

Rep: Reputation: 15
If anyone still cares about this thread, what I do is start the VNC server with -localhost.
When I want to connect from a client, I start an ssh session and just tunnel both vnc ports. Assuming that VNC was started on display #1:

ssh -l <username> -L 5801:127.0.0.1:5801 -L 5901:127.0.0.1:5901 <servername>

Then I open either the VNC viewer or my Java-enabled browser and connect to my localhost's VNC port. Ssh forwards the local port through the remote machine's localhost port:

Browser: http://127.0.0.1:5801
VNC viewer: 127.0.0.1:1

Last edited by netindustries; 09-05-2004 at 09:48 PM.
 
Old 09-12-2004, 03:17 PM   #9
Alinuxnoob
Member
 
Registered: Feb 2002
Location: Van city
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
Ok so what are you saying is that if you add unset SESSION_MANAGER to the vnc script does this become an active session?

Cause i kinda wanna be able to start an active session and also start a new session....
 
Old 09-12-2004, 08:20 PM   #10
netindustries
LQ Newbie
 
Registered: Mar 2004
Location: Indianapolis
Distribution: Slackware 9.1
Posts: 25

Rep: Reputation: 15
Well I was mentioning how I get a secure session with ssh, and I kinda dropped the method of using the script to start up in favor of inetd and kdm. For Slack, I really had to do some research to get it working, because the "simple method" of using inetd and /etc/services didn't seem to work with kdm, but the server was just misconfigured.

I documented all (I think) of the steps I went through to get it running. I can post it here if you like, but it is very long, more of a HOWTO. I've been trying to subscribe to the TightVNC list to post it, but keep getting rejected.

Let me know. The method also works with Cygwin's X on Windows once the Slack server is configured.
 
Old 09-12-2004, 10:38 PM   #11
Alinuxnoob
Member
 
Registered: Feb 2002
Location: Van city
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
YES Please do Cause I do want to have the option to get a active session instead of creating new ones.. or @ least be able to get two option to do an active session or create a new one.

Thanks in advance...
 
Old 09-13-2004, 06:38 PM   #12
netindustries
LQ Newbie
 
Registered: Mar 2004
Location: Indianapolis
Distribution: Slackware 9.1
Posts: 25

Rep: Reputation: 15
I think I'm understanding your question a little better, hopefully.

Do you want to:

1. Connect to the X desktop that is running on the server, i.e. one that you started with startx or startkde at the server's console? Like PC Anywhere or Remote Control.

2. Start a new VNC session and be able to disconnect from the server (not log out of the desktop session), then reconnect later with your VNC desktop in the same state you left it (open windows, running commands, etc.)?

3. Start a new VNC desktop session each time someone connects (by logging into xmd, kdm or gdm) and then kill the session when they disconnect (by logging out of the desktop or by clicking disconnect)?

It sounds like you want a combination of 2 and 3, in which case you would run the vncserver script at bootup (an entry in /etc/rc.d/rc.local) for 2 , and use inetd to run Xvnc as a service for 3.

To connect to a previous VNC session (with opened windows, etc.) you would probably connect to servername:1 (port 5901). To get a fresh new login session, you would connect to servername:0 (port 5900) for a new login session for each running instance of VNCViewer.

Just wanted to make sure what you're asking before you go through a lot of work only to not have it do what you wanted.
 
Old 09-14-2004, 04:22 PM   #13
Alinuxnoob
Member
 
Registered: Feb 2002
Location: Van city
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
Yes want to be able to login on to my PC which is login to the screen which is currently running before I leave to goto work and ssh VNCtight to where I left off before I goto work... in other words
1. Connect to the X desktop that is running on the server, i.e. one that you started with startx or startkde at the server's console? Like PC Anywhere or Remote Control.

2.
3. Start a new VNC desktop session each time someone connects (by logging into xmd, kdm or gdm) and then kill the session when they disconnect (by logging out of the desktop or by clicking disconnect)?


I'm already setup ssh to localhost:1 and do vncserver using localhost:1
but it always starts a new session I want to be able to get a option to start a new session or get back to the session I have going....
 
Old 09-14-2004, 07:54 PM   #14
netindustries
LQ Newbie
 
Registered: Mar 2004
Location: Indianapolis
Distribution: Slackware 9.1
Posts: 25

Rep: Reputation: 15
OK tough guy, you asked for it:

I use KDE 3.1 so that's what I'll tell you how to use. We'll be using KDE's Desktop Sharing (for #1) which is located in KMenu -> Settings -> Control Center -> Internet & Network -> Desktop Sharing. Open Control Center, expand Internet & Network, select Desktop Sharing. Check "Allow uninvited connections" and "Allow uninvited connections to control desktop". Set a password. Go to the network tab and set the port to 5901. We will be using 5900 for inetd connections (#3) to get fresh new desktop sessions on each connect. Hit Apply, then close Control Center.

You should now be able to go to work and screw around encrypted-style with your paused game at home by doing:
ssh -l username -L 5901:127.0.0.1:5901 servername
then open a vncviewer and connect to 127.0.0.1:1
There's #1.

For #3 I'll just paste my lil' tutorial about kdm, XDMCP, VNC and inetd on Slackware 9.1:

----------------------------------------
Remote Server Setup (Xvnc Server Machine)
----------------------------------------

----------inetd Configuration----------
--------------------
/etc/inetd.conf
--------------------
The following line added to /etc/inetd.conf will need to be modified according to your desired resolution, color depth and system's paths to Xvnc and fonts.

Add the following line near the end of the file:
vnc stream tcp nowait root /usr/local/sbin/Xvnc Xvnc -inetd -query localhost -once -geometry 800x600 -depth 24 -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/
--------------------

--------------------
/etc/services
--------------------
Find the sequential spot in /etc/services to put the following port:
vnc 5900/tcp #TightVNC Viewer Port
--------------------

----------XDMCP Configuration----------
--------------------
Check for existence:
/etc/X11/xdm/Xwilling
--------------------

--------------------

/etc/X11/xdm/xdm-config
--------------------
Comment this line with a !
! DisplayManager.requestPort: 0

Point this attribute in /etc/X11/xdm/xdm-config to the Xwilling script:
DisplayManager.willing: su noboby -c /etc/X11/xdm/Xwilling
--------------------

--------------------
/etc/X11/xdm/Xaccess
--------------------
Uncomment the line:
* #any host can get a login window

Uncommenting the following line seems the only reason XDMCP didn't work:
#* CHOOSER BROADCAST #any host can get a chooser
LEAVE THIS COMMENTED!
--------------------

--------------------
/opt/kde/share/config/kdm/kdmrc
--------------------
Change from false to true:
[xdmcp]
Enable=true (or 1 in some distributions)
Port=177
--------------------

--------------------
/etc/X11/XF86Config
--------------------
Add if it doesn't exist with other FontPaths
FontPath "unix/:7100"
--------------------

--------------------
/etc/X11/xdm/Xservers
--------------------
Run the command:
chmod 444 /etc/X11/xdm/Xservers
--------------------

--------------------
/etc/X11/xdm/Xsetup_0
--------------------

--------------------
Run the command:
chmod 755 /etc/X11/xdm/Xsetup_0
--------------------

--------------------
Configure user login shell:
On the vncserver machine, go to KDE User Manager in KMenu -> System -> KUser
Double-click the user you will login as in kdm
Select the default login shell (/bin/bash)

Log out of KDE

Run these commands in the console:
killall Xvnc
killall inetd
killall kdm
kdm
inetd
--------------------

----------------------------------------
Local Client (Xvnc Viewer Machine)
----------------------------------------
--------------------
Run the command:
ssh -l <username> -L 5900:127.0.0.1:5900 <remotehost>

Open 127.0.0.1:0 in an Xvnc Viewer.
Login through kdm in VNC.
--------------------

----------------------------------------
Resources
----------------------------------------
--------------------
http://www.tldp.org/HOWTO/XDMCP-HOWTO/procedure.html
http://www.faqs.org/docs/Linux-HOWTO...HOWTO.html#GDM
http://www.dei.isep.ipp.pt/~andre/extern/ixvnc.htm
http://www.realvnc.com/swish-e/searc...&submit=Search
--------------------

Last edited by netindustries; 09-14-2004 at 08:07 PM.
 
Old 09-14-2004, 08:28 PM   #15
Alinuxnoob
Member
 
Registered: Feb 2002
Location: Van city
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
Ok Thanks for the info.... Will try it when I get to work....
 
  


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
vnc into session 0 fraz Linux - Networking 5 11-21-2005 07:36 AM
VNC starts new xwindows session sephiro499 Linux - Newbie 15 11-17-2004 03:51 PM
see the vnc session on vnserver cabo Linux - General 5 09-13-2004 04:07 PM
Same session in Tight VNC? fiacobelli Linux - Networking 1 08-07-2004 10:03 AM
Vnc server session Slackware 9.1 Johny_B Linux - Software 5 04-19-2004 09:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:42 PM.

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