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


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.


Anonymous said...

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

Anonymous said...

thanks that was very helpfull

krishna said...

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

Maxwell Smart said...

Simple and accurate for CentOS. Thanks!

Narendra Lengade said...

Thanks a lot the above procedure worked fine for me

Unknown said...

so simple and worked! thanks a lot

Anonymous said...

Thnks Buddy, i have done in Backtrack

Jim Zubemo said...

Thanks for the post.
It was helpful.


Simple and accurate. Thanks!

Anonymous said...

thanks a lot for the info

Anonymous said...

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.

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 if you have any


Marc Sarri said...

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

Khingcat said...

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

Khingcat said...

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

syuz said...

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

Ken said...

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
Would you like to enter a view-only password (y/n)? n
pi@raspberrypi ~ $ service vncserver restart
vncserver: unrecognized service

Ken said...

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 !

Anonymous said...

Thank you, works fine on my raspberry ! You have saved my time !

greetings from France

David Maina Waimonde said...

Thanks. It was of great help

Anonymous said...

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!

Unknown said...

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.

Anonymous said...

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


shankar said...

Thank you, that worked without restarting the server

James said...

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.