Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    VNC cant connect on without "vncserver" command


    I downloaded and installed vncserver on my FC4 using the yum install command. I entered "vncserver" was prompted for a password etc...

    I also downloaded and installed a viewer on my windows laptop.

    I was able to get around the twm and graphical display by referring to some previous posts on the forum.

    My FC4 boots up to runlevel 3, and i just need VNC for purposes where i have to do somethings using the GUI, as a newbie.

    My problem now is:
    When my FC4 boots up, and I try to connect from my windows Laptop, i continue to get a connection refused error, until i type "vncserver" on my FC4 machine directly, then i get some three lines below:
    xauthstdin):1 bad display ip add command
    New "my ip" (root) desktop is "my ip
    starting applications specified in /root/.vnc/xstartup
    log file is ............................
    Except i issue the command "vncserver", i wont be able to connect from windows VNC viewer. pls how do i re-solve this issue.


  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    Edit /etc/sysconfig/vncservers

    Change and uncomment the two example lines at the end of the file to tell the system who you want the servers for, and the size of display you want.

    Then do (as root):

    service vncserver start

    This will start a vnc session seperate to your main logon, make sure you use the <servername>:<screennum> argument correctly when you connect.

    If you want this in your runlevel when you boot up, use:


    to add it to runlevel 5. You can also add it to runlevel 3 if you want - it'll run quite happily in the background of both runlevels. If you do this, it'll start when the machine boots into those runlevels.
    Linux user #126863 - see

  3. #3
    thanks Roxoff,

    i went to /etc/sysconfig and vi'd into file:vncservers. I uncommented the two last lines in the file as follows:

    VNCSERVERARGS[2]="-geometry 800x600"

    using the command:

    service vncserver start

    I get an error" Starting VNC server: 2: myusername runuser: user myusername does not exist"

    so i redited the vnservers file and changed "myusername" to a valid user on my FC4. Still, i get a

    "starting VNC server: 2:toks {FAILED]

    when i use the command "service vncserver start"/stop

    i still get a failed result.

    I could't find any "system-config-services" file at /etc/sysconfig. I did a locate, and the ones i found are at /usr/sbin and /usr/bin

    I rebooted my pc and first checked the status of tells me its stopped.

    Pls how do i add it to the runlevel 3 and 5 as you mentioned earlier on?


  4. $spacer_open
  5. #4
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    Ahhh - I missed a bit.

    For the user who's having the vnc session, create a '.vnc' directory in their HOME directory.

    Inside this, make an executable file called 'xstartup' to start off the server session.

    Mine looks like this:

    xrdb $HOME/.Xresources
    xsetroot -solid grey
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    xosview &
    # start the window manager of choice... today it's KDE!
    May I also suggest you use the 'vncpasswd' command for that user too.
    Linux user #126863 - see

  6. #5
    Just Joined!
    Join Date
    Feb 2005
    Velden - Netherlands
    in /etc/sysconfig

    put the lines:
    VNCSERVERARGS[2]="-geometry 800x600"

    if toks is your valid username and you want a screensize of 800x600
    start your vncserver with:
    vncservers :2
    It will create the .vnc directory itself after it askes for your password

    Then edit your xstartup if you want a gui.
    mine is :


    # Uncomment the following two lines for normal desktop:
    vncconfig -nowin &
    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 &
    kill the vncserver with:
    vncserver -kill :2
    restart the vncserver:
    vncserver :2
    And open the ports on your firewall. 5802, 5902, 6002 (all tcp, the 2 is for scrren 2, change if you have an other screen number)

  7. #6
    thanks guys,

    Pls, im still a little confiused. When I uncommented the line

    VNCSERVERARGS[2]="-geometry 800x600"
    and substituted "myusername" with "toks", as I complained, i was getting errors.

    Note: I have VNC running fine as root. I would also like to set it up for a user "toks"

    Bikerepairmann>> note that the file /etc/sysconfig/vncservers is not editable by user "toks"

    so how do about changing/substituting the lines VNCservers="2:myusername"....

    suppose I have multiple users, where only somepeeps out of the many are allowed to use VNC, how am I to configure VNC selectively?


  8. #7
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    You can only edit /etc/sysconfig/vncservers as root.

    When you do:

    service vncserver start

    you must also do that as root.

    Make sure that for each user who has a vnc session listed in /etc/sysconfig/vncservers that they have a .vnc directory in their home directory, and add an xstartup file in there to start off any window managers or other apps. xstartup must be made executable too.
    Linux user #126863 - see

  9. #8
    Since it is unacceptable to post a reply in more than one thread within the forum, Kindly check my query here


  10. #9
    Make sure that for each user who has a vnc session listed in /etc/sysconfig/vncservers
    Shouldn't I be a root to add vnc sessions for each users ?

    While I was reading this threat
    6.VNCSERVER="1:username" (example root). Make a space before the quotes if
    you want to add another user and type 2:username, etc.
    I get confused how to add more than one users,,,,do I need to do like below ?

    VNCSERVERARGS[2]="-geometry 800x600"

    VNCSERVERARGS[3]="-geometry 800x600"

    VNCSERVERARGS[10]="-geometry 800x600"

  11. #10
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    North Carolina

    it says ubuntu but it works for others also, just not exactly as shown since you don't need to add the extra apt stuff, other then that it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts