I have ubuntu, vnc server (Xvnc4) starts on boot with 2 sessions:
VNCSERVERS="1:user1 2:user2"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 24"
VNCSERVERARGS[2]="-geometry 1024x768 -depth 24
Every time vnc server starts – I need to login via vnc to each session and start a program manually.
Is it possible to run automatically a command within specific vnc session?
Best Answer
There are a few different ways to get this done as you might imagine, but this is probably the most appropriate. There's a shell script named
xstartup
created when you runvncpasswd
the first time for a user. This file can be modified to run arbitrary code. When modifying and testing changes, set up debug logging and tail the relevant logfiles to troubleshoot the changes.Several VNC-related files are found in the directory $HOME/.vnc. Among them:
Often, setup will place logic in
~/.vnc/xstartup
and you'll need to use discretion to insert the line to be run when a session is initiated. Try starting something simple but good at producing error messages at first, likeFor best results insert that line before or after the line in xstartup which starts your window manager.