If you're going to use the vncssh script, you would have to add the key before running the script. There's no way to put the key on the ssh command line, which is inside the script.
You could edit the script and add the -i option to the ssh command, but then you'd have to edit the script every time you wanted to connect to a different host.
I could edit the script so that you could put the key on the command line when you start vncssh, but I only just thought of that now.
If you don't use the script, you'd just add the -i option to the ssh command, like you'd normally do.
Oh yeah, you'd first have to ssh in to the remote machine to find the auth file for lightdm and use that on the ssh command line. Or use the vncserv script on the server side, which finds the auth file for you.
Oh yeah, oh yeah - you might not have to do that, because I've noticed that the authfile for lightdm always has the same name (except maybe for the :0 at the end, which I assume is the display.)
So the command would look something like this...
- Code: Select all
ssh -t -L 5900:localhost:5900 -i /path/to/id_rsa user@remote-host 'x11vnc -auth /var/run/lightdm/root/:0 -localhost -display :0'
or this:
- Code: Select all
ssh -t -L 5900:localhost:5900 -i /path/to/id_rsa user@remote-host '/usr/local/bin/vncserv'
And then you have to open another terminal and run vncviewer.
vs. using the script:
- Code: Select all
ssh-add /path/to/id_rsa
vncssh user@remote-host