VNC: no profile for user error

If you want to vnc into the server with gnome and get a vnc error like so

Mon Aug 24 09:54:02 2009
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5901
 vncext:      Listening for HTTP connections on port 5801
 vncext:      created VNC server for screen 0
localuser:bpeh being added to access control list
No profile for user 'bpeh' found
SESSION_MANAGER=local/lamit:/tmp/.ICE-unix/13642

check your home dir permission. it should not be writable by anyone (I like permission 750) and the file .dmrc within your home dir should have 644 permission.

Configuring VNC Server For Multiple Users

* VNC Server allows sysadmin to administer the server in GUI environment provided the server is able to boot up in run level 5. We are setting up 2 users for vnc access in this instance.
* If not already done, install vnc server.

yum install vnc-server

* In /etc/sysconfig/vncservers

VNCSERVERS="1:user1 2:user2"
VNCSERVERARGS[2]="-geometry 1280x1024"
VNCSERVERARGS[3]="-geometry 1280x1024"

* Manually switch between users and run vncpasswd. Assuming you are root.

su - user1
vncpasswd
// repeat for x number of users

* Open up the vnc ports in the firewall. The vnc ports start from 5901. So if I have 5 users, the port range is from 5901 to 5905

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT

* restart firewall and vncserver

service iptables restart
service vncserver restart

* (optional) To allow users to have access to the Gnome interface. Go to the user’s home directory

vim ~/.vnc/xstartup

* Uncomment these 2 lines

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Restart the vncserver again.
* All done. Test it out!

Quick vnc tips

1. To login to gnome of kde via vnc, in ~/vnc/xstartup, uncomment the 2 lines below “uncomment…”

#!/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 &

2. To start vnc for specific users automatically at bootup, in /etc/sysconfig/vncservers

VNCSERVERS="1:username"
VNCSERVERARGS[2]="-geometry 1280x1024"