Can anyone say me how to set a VNC password in Ubuntu? Such that if anyone access my machine through VNC it should prompt for a password.
2 Answers
You can set a password when you open Remote Desktop.

Or withvncpasswd you can also set the password for the vnc-server.
So if someone want to connect to you, he has to enter the password.
- 359
- 1
- 3
-
`vncpasswd` doesn't work for me. – karthick87 Apr 24 '11 at 13:13
-
2Which vnc server do you use? Start Options: vnc4server: Command to start: `vncserver`. Then run `vncpasswd`. tightvncserver: Command to start: `tightvncserver`. Then run `vncpasswd`. Gnome build in vino-server: Command to start: `vino-preferences` And Activate: "Allow other users to view your desktop" and set a password. – Dani3l Apr 25 '11 at 07:29
In my case, I forgot the password to the VNC server. For my situation, the final target was TightVNC running on Ubuntu 18.04 which I needed to reach from my mac.
You first kill the existing VNC sessions with
vncserver -kill :1
Use something like this to find out if you've killed all sessions. Usually, the vncserver is running on port 5901:
sudo netstat -peanut | grep "vncserver"
If there is something, repeat the kill command with the appropriate vncserver -kill :2 or whatever listing. If nothing, then you can remove the default original password setting with:
sudo rm ~/.vnc/passwd
Restart the vncserver as:
vncserver
And you'll be prompted again for a new password. The daemon should run on port 5901, which you can query with the netstat command above.
- 161
- 1
- 3