Wednesday, May 20, 2009

How to change VNC Server password on Linux

I was recnetly asked how to reset a password for VNC Server on a Linux machine.
For those that would also like to know here is how I did it.

You can either connect to the machine remotely over an ssh program like putty or you can do this directly from the terminal.

Open up a command prompt for the user that you have vnc server running as.
Then type

vncpasswd


You will then be prompted to enter a new password twice. Choose your new vnc server password and then restart the vncserver service using the following command.

service vncserver restart


The above commands work when run as the root user on Centos but should work similarly on most other variation of Linux.

Hope this helps.

24 comments:

  1. Thanks for the tip. I have been fighting with VNC Server for a while trying to figure this out.

    ReplyDelete
  2. thanks that was very helpfull

    ReplyDelete
  3. thanks for the info.i am able to reset the password successfully

    ReplyDelete
  4. Simple and accurate for CentOS. Thanks!

    ReplyDelete
  5. Thanks a lot the above procedure worked fine for me

    ReplyDelete
  6. so simple and worked! thanks a lot

    ReplyDelete
  7. Thnks Buddy, i have done in Backtrack

    ReplyDelete
  8. Thanks for the post.
    It was helpful.

    ReplyDelete
  9. thanks a lot for the info

    ReplyDelete
  10. Hey gentlemen!!

    I read your post but it doesn't work for me. I am trying to connect to my remote server red hat 5.2 by using Tight VNC Viewer installed on my local system XP. My /etc/sysconfig/vncserver contains following entry.

    VNCSERVERS="3:oracle"
    VNCSERVERARGS[3]="-geometry 1024x768"

    I did following steps
    1. Login as oracle (by using putty) and then fire $vncpasswd command to change password.
    2. Then Login as root and restarted VNC service
    3. Then I tried to connect to my remote host through tightVNC
    But it returns error "Authentication Failed" even though i am entering correct password. It seems to me that it is not getting my changed password yet mean while I don't know old password and that's why i changed it.

    So plz can anybody help me to resolve this issue? Is password for VNC user stored in any file in user readable form?

    Optionally you can send me mail on tusharlapani@gmail.com if you have any
    solution.

    Thanks

    ReplyDelete
  11. It doesn't work on raspian, when i try to reset it it says:
    vncserver: unrecognised service

    ReplyDelete
  12. Can it be applied on Raspberry Pi? I run Raspbian on it.

    ReplyDelete
  13. Can it be applied to reset the password if I forgot the old password?

    ReplyDelete
  14. how to reset vncserver password on raspian..help me please.. i try insert vncpasswd and key in the new password.but cannot restart the service...help me

    ReplyDelete
  15. I've just used it successfully on RPi via ssh from iMac… I ignored the apparent 'unrecognised service' error !

    Using password file /home/pi/.vnc/passwd
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    pi@raspberrypi ~ $ service vncserver restart
    vncserver: unrecognized service

    ReplyDelete
  16. Today (2014-03-26), using suggested commands via iMac SSH (wifi), I reset the tightvncserver password on my RPi (NOOBS_v1-3-2 updated)…

    I also got the 'vncserver: unrecognised service' message... but IGNORED it, and tried an iMac VNC (wifi) connection… success !

    ReplyDelete
  17. Hello
    Thank you, works fine on my raspberry ! You have saved my time !

    greetings from France
    JPh

    ReplyDelete
  18. It worked for me using as a guest a raspberry pi B+ with raspian and a windows 7 with a tightvnc as a client. Thank you very much!

    ReplyDelete
  19. Interesting! I am also getting authentication failed when connecting from my raspian machine to the pi running the vncserver after changing the password (to what I guessed was the old password). However, I am connecting successfully from my Blackberry Playbook tablet (using iMT VNC). I did not change the stored password on the Playbook, therefore I had not forgotten the original vncserver password. Oh yes, I also couldn't restart the server, I just re-booted. Will investigate.

    ReplyDelete
  20. worked for me. however, i have to use command "vncserver restart" to restart vnc instead of service vncserver restart.

    thanks

    ReplyDelete
  21. Thank you, that worked without restarting the server

    ReplyDelete
  22. Good posts last forever - worked in my case: I could only remember the view only password. reset both passwords and bam - mouse and keyboard functional again.

    ReplyDelete