Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

When a user first runs vncserver, the following ~/.vnc/xstartup file gets created:


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

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

I want to modify the default file so that the following lines are uncommented:

exec /etc/X11/xinit/xinitrc

How should I go about this?

share|improve this question
Just uncomment these two lines and restart your vncserver. Your default desktop will be started by vncserver –  Serge Oct 26 '12 at 15:02
I want it to be done by default for all new users. I.e., change the default ~/.vnc/xstatup that is created. –  Belmin Fernandez Oct 26 '12 at 15:05
This is not clear from your question :) wait a second... –  Serge Oct 26 '12 at 15:07
Any suggestions on how to make the question clearer (seems like you already have my answer but for others visiting the site :-)). –  Belmin Fernandez Oct 26 '12 at 16:26

1 Answer 1

up vote 2 down vote accepted

Create a file /etc/vnc/xstartup with the following content:

exec /etc/X11/xinit/xinitrc

And give it the read and execution permissions to all users:

chmod 0755 /etc/vnc/xstartup

Then this script will be executed by any user's vnc server

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.