-   Linux - Newbie (
-   -   Cannot start vnc server because the USER environment variable is not set (

izac5 08-06-2003 03:56 PM

Cannot start vnc server because the USER environment variable is not set
We cannot load vnc server on startup. The only way we can get to run is to stop and start the service once were in KDE. This is unacceptable because we need to remotely administrate it.

How do we set the USER environment variable for VNC server?

Startup error looks like this

“Starting vncserver: Starting VNC server: 3: root vncserver: The USER environments variable is not set”


TheOther1 08-06-2003 04:18 PM

I am guessing this is you:

/root/.vnc/xstartup: !/bin/sh: No such file or directory
sh: /lib/cpp: No such file or directory
xset: bad font path element (#37), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
This message tells me that the file /root/.vnc/xstartup doesn't exist. If it does, do chown root:root /root/.vnc/xstartup and make sure you own it. Not sure of rights needed on it but I would guess 722 would do it.

I was hoping I could find you an answer. I have not ever had that problem on any distro. I know you have to log in least once and start vncserver from command line to build required dirs and files and configure passwords.

Please let us know what happens and what the problem was.

izac5 08-06-2003 04:45 PM

Thanks for the quick reply.
that is me

the file xstartup does exist and it looks like this


xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &

As far as permissions go im not that knowledgable. But in the permissions tab root is the owner and ive given read write and exec permissions to user, group, and others

stickman 08-06-2003 04:57 PM

Have you tried creating a small rc script with USER and HOME in it? Something like:
export USER HOME
vncserver :2

Of course you may want to reconsider running it as root.

joab 11-21-2009 08:10 PM

the reason for this is that when the vncserver was started the login user is not the one who executed the vncserver at startup.

to solve this, do this:

edit your /etc/rc.local
and add this: su -c "vncserver -depth 32 -geometry 1024x768" your_username

save and close then reboot your pc.

All times are GMT -5. The time now is 07:50 AM.