every line in a linux .vnc xstartup explained

I have been struggling for a few days getting a vnc server to work in my new Debian server with Cinnamon desktop. Doing google searches returns a wealth of “try this and see if it sticks to the wall” type approach.  Well, not satisfied with that I am attempting to explain here every line in a common /home/username/.vnc/xstartup file, so when you go for troubleshooting you can fix things yourself more intelligently. Feel free to comment if you can add more to this thread.

Common xstartup file lines and their meaning:

#!/bin/sh

First line of any executable script. The file needs execute permissions to run (obviously). That’s “chmod 755 xstartup” if you have issues there.  Don’t let the leading # comment tag fool you, as this is not really a comment, this is necessary to invoke the /bin/sh shell to run the rest of the lines of the script.  This is explained in wikipedia under “shebang (unix)”

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

TBD

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

The [ -x /something ] construct means “if /something file eXists then”.   && is the logical and operator (if 1 and if 2). The way it is implemented here is an if then.  Basically this is saying if the /etc/vnc/xstartup file exists then execute it. Otherwise continue on. I believe the /etc/vnc/xstartup file is a system wide kind of file, where the user based xstartup is specific to that user.

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

Same as above.  FWIW, I don’t have an /etc/vnc/ directory or a $HOME/.Xresources file.

xsetroot -solid grey

 

vncconfig -iconic &

 

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

 

twm &

Leave a Reply

Your email address will not be published. Required fields are marked *