How can I have new ~/.vnc/xstartup files be configured for normal desktop by default?

37,041

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

#!/bin/bash
unset SESSION_MANAGER
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:
37,041

Related videos on Youtube

Belmin Fernandez
Author by

Belmin Fernandez

Learning and helping.

Updated on October 03, 2020

Comments

  • Belmin Fernandez
    Belmin Fernandez almost 2 years

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

    #!/bin/sh
    
    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    # 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:

    unset SESSION_MANAGER
    exec /etc/X11/xinit/xinitrc
    

    How should I go about this?

    • Serge
      Serge almost 10 years
      Just uncomment these two lines and restart your vncserver. Your default desktop will be started by vncserver
    • Belmin Fernandez
      Belmin Fernandez almost 10 years
      I want it to be done by default for all new users. I.e., change the default ~/.vnc/xstatup that is created.
    • Serge
      Serge almost 10 years
      This is not clear from your question :) wait a second...
    • Belmin Fernandez
      Belmin Fernandez almost 10 years
      Any suggestions on how to make the question clearer (seems like you already have my answer but for others visiting the site :-)).