Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 39023 - tightvnc init.d script
Summary: tightvnc init.d script
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High enhancement (vote)
Assignee: Luca Barbato
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-22 04:36 UTC by Luca Barbato
Modified: 2007-04-12 21:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
conf.d (vnc,339 bytes, text/plain)
2004-01-22 04:37 UTC, Luca Barbato
Details
init.d (vnc,1.46 KB, text/plain)
2004-01-22 04:38 UTC, Luca Barbato
Details
redhat vncservers init script ported to gentoo init architecture (vncservers.init.d,725 bytes, text/plain)
2004-06-26 14:23 UTC, Matthew Caron
Details
redhat vncservers config script ported to gentoo init architecture (vncservers.conf.d,62 bytes, text/plain)
2004-06-26 14:23 UTC, Matthew Caron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Barbato gentoo-dev 2004-01-22 04:36:44 UTC
just a reminder, please take a look at the script I attach (the scripts aren't mine but from an user)
Comment 1 Luca Barbato gentoo-dev 2004-01-22 04:37:32 UTC
Created attachment 24230 [details]
conf.d
Comment 2 Luca Barbato gentoo-dev 2004-01-22 04:38:20 UTC
Created attachment 24231 [details]
init.d
Comment 3 Daniel Ahlberg (RETIRED) gentoo-dev 2004-01-22 04:44:55 UTC
http://forums.gentoo.org/viewtopic.php?t=72893
Comment 4 John Richard Moser 2004-01-31 13:19:35 UTC
vncd hacks are an annoying thing.  I just wrote my own actually, it takes a conf.d file that's just a bunch of lines of user,display,geometry and su's to the user, then runs vncserver $display -geometry $geometry.

What we REALLY need is an actual vncd coded for tightvnc.  It should require a username/password entry, and then track that, on connect.  Here's how this would be done securely:

 - vncd service running, listening on port 5999 (vnc uses 5900 + display, this would equivalate to :99)
 - User connects with vncviewer to vnchost:99
 - A new vncserver is spawned, on a new display, on a new port, and the connection is directed at it.  This is the same as what apache does; the client port will be 5999 and the server port will be something else.
 - There is *no* password, screen immediately comes up with no authorisation.
 - vncd starts up vncdauth, an X program that demands that the user enter a username and password (just like xdm/gdm does).
 - vncd checks to see that the username/password is valid AND the user is in group vncusers, if not, kills the Xvnc that was started.
 - If the user is still connected (authorization approved), then it starts up gdm/kdm/xdm/xsession/etc.  Optionally, the user may chose from a list of already running VNCs and connect to those without entering his password, but this will still cause the chosen VNC to request authorization for reconnect
 - VNC session operates as normal from then on
 - When other connections come directly in to a user's vnc, the vnc requests authorization as a normal vncserver would, from the vncpasswords in ~/.vnc
 - When the WM is exited, the Xvnc dies, connection is closed.

This is the only real way to make something like this actually majorly useful for generalized remote logins; running a hundred VNCs for each of your users is impractical.
Comment 5 Matthew Caron 2004-06-26 14:21:27 UTC
Hey, the scripts look better than mine (attached after this; basically ported from what FC1 uses to the gentoo init architecture). The one problem I have with these scripts is that I changed:

su ${user%%:*} -c "PATH=$PATH:/usr/X11R6/bin vncserver :${user##*:} $VNC_OPTS" &>/dev/null

and the ilk to 

su ${user%%:*} -c "vncserver :${user##*:} $VNC_OPTS" &>/dev/null

See, when root's shell has been changed to TCSH, changing the path doesn't work correctly. So, either check and see what root's shell is, or don't set it at all.
Comment 6 Matthew Caron 2004-06-26 14:23:28 UTC
Created attachment 34227 [details]
redhat vncservers init script ported to gentoo init architecture
Comment 7 Matthew Caron 2004-06-26 14:23:57 UTC
Created attachment 34228 [details]
redhat vncservers config script ported to gentoo init architecture
Comment 8 Matthew Caron 2004-07-05 13:53:46 UTC
Add - the init script needs modified depend section as follows:

depend() {
        need net
        after netmount nfsmount
}

Because if you're NFS mounting home, it can only start after those are done...
Comment 9 Matthew Caron 2004-07-06 21:00:10 UTC
Add - the init script needs to cd into the user's homedir when starting the server (the redhat one does this already). Otherwise, the default path that xterm gets when it starts is wrong (among other things).

Something like:

su ${user%%:*} -c "cd ~${USER} && vncserver :${user##*:} $VNC_OPTS" &>/dev/null

works.
Comment 10 Mark Cooper 2005-06-10 02:29:19 UTC
Are these scripts in any of the tightvnc ebuilds yet?
Comment 11 Disenchanted (RETIRED) gentoo-dev 2006-05-06 21:14:02 UTC
go for it
Comment 12 Raúl Porcel (RETIRED) gentoo-dev 2007-04-12 21:01:14 UTC
Added the scripts to both tightvnc and vnc, thanks to the one who made them, and thanks Matthew for the info :)