[CentOS] USB, AutoMount & VNC

Sat Mar 28 02:28:18 UTC 2009
Bart Schaefer <barton.schaefer at gmail.com>

On Fri, Mar 27, 2009 at 4:12 PM, Frank Thommen
<frank.thommen at embl-heidelberg.de> wrote:
> I assume that with "console" you mean X11/desktop manager.  In this case
> Gnome or KDE handle the mounting of removable devices for you.  The
> automounter hasn't anything to do with it.

Consequently the other option is to change the VNC configuration so
that you're running the Gnome or KDE desktop manager in VNC.  The
tricky bit then is to get it to log out properly as if you were really
on the console.

I put the following in $HOME/.vnc/xstartup to accomplish that on CentOS 5:

---- 8< ---- snip ----

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-terminal --geometry=80x24+10+10 --title="$VNCDESKTOP Desktop" &
( gnome-session ; kill `cat $HOME/.vnc/${VNCDESKTOP% *}.pid` ) &
---- 8< ---- snip ----

This runs gnome-session in the background, then kills the desktop when
the session ends.  Replace gnome with KDE to taste.

The "recommended" way to run the desktop ...

# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc

... has the undesirable side-effect of leaving the VNC server running
with no session or window manager and no X clients when you exit from
the session.  This is annoying unless you also configure the server to
exit on the last client disconnect.  I prefer having the server
disconnect the clients when the session ends, instead.

(I'd be happy to learn there's a more convenient way to accomplish that.)