I use RealVNC to remote-control my computer while on the go. But it annoys me that I have to type the access password each time. Is it possible to make RealVNC (Or any other VNC implementation) work with my keypair instead of a password?
One simple method that I regularly use when access a Linux VNC server is to just setup VNC to not require a password at all. But I also set it to only listen for connections on the loopback interface (127.0.0.1).
Then I simply create an SSH tunnel to my box and use the SSH port forwarding for the authentication and remote access.
If you pay for the Enterprise edition, presuming all your machines are in a domain, you can have RealVNC use your current login credentials instead of a separate user name and password using the single sign-on option.
From the docs:
Single sign on
The Single sign-on authentication mechanism extends system authentication to automatically authenticate a connecting user to any instance of VNC Server on any host computer using the credentials initially supplied to log on to the client computer. For this to work, all host computers must be on a domain, and all instances of VNC Server must have Single sign-on specified. Note this feature is not available for VNC Viewer for Java; web browser users must always supply a user name and password in order to connect.
Tigervnc has an option to pass the passwd file from the server. Thus copying that file from the server on the client (using ssh with keypair) allows to log in without the need to enter a password:
scp host:.vnc/passwd ~/.vnc/passwd.host
vncviewer passwd=~/.vnc/passwd.host host:5901
The documentation mentions
--passwd but with version 1.9.0only the
passwd version works.
Unlike the no password, only local access solution, this prevents other users on the same host to connect to the vncserver. It can however be combined with the local access only, to restrict who can try to brute-force the vncserver.
Note1: The documentation says the file needs to be on the same filesystem, but copying worked for me. Not sure whether the passwd file is ever changed and needs to be copied again. - from my observation this does not seem to be the case.
Note2: This is not really a key pair, as it seems to be a hash of the password stored on both sides.