0

Any idea why VNC stopped working after setting up SSH for authenticating with keys only? (No password)

I use Debian 10 and tightvnc server with tigervnc client. It has worked nicely until now.

Here's what I get when trying to establish the SSH tunnel:

ssh -L 5901:localhost:5901 [email protected] bind [127.0.0.1]:5901: Address already in use channel_setup_fwd_listener_tcpip: cannot listen to port: 5901 Could not request local forwarding.

I find this in the log after attempting to connect with TigerVNC Client:

/var/log/auth.log Oct 7 06:24:17 pokip sshd[4686]: error: connect_to localhost port 5901: failed.

channel 3: open failed: connect failed: Connection refused

Another thing I did before it stopped working was to create a pair of keys on my wifes computer and VNC into the server from there to my usual sudo account on the server. Worked! Then I went back to my own computer and could not do VNC from there anymore. I can still SSH in with keys though.

5
  • The message "Address already in use" says that there is already something listening on that port (5901) in your case. Try to figure out which program that is or us another port ie. 5910:localhost:5901 if VNC is listening on 5901.
    – Lambert
    Oct 7, 2019 at 5:56
  • Restarted vncserver, but it still says 'already in use. Now I noticed that VNC works if I connect without SSH. Serveradress:5901 port works, just not with SSH for some reason?
    – Rimfire
    Oct 7, 2019 at 6:05
  • 1
    It's the client who has port 5901 already in use so SSH cannot setup port forwarding. Try to figure out which client process has port 5901 open by using netstat -antp|grep 5901
    – Lambert
    Oct 7, 2019 at 6:44
  • Ditto. It's -L, so the listening port would be on the local side. Address already in use refers to the local side. Oct 7, 2019 at 6:50
  • You are right, I must have had something listening to 5901 on the client computer. Next day I rebooted and now it works. Maybe it had something to do with me tunneling in to Ubuntu running in a virtualbox on the same computer. @Lambert Your comment could be an answer, couldn't it?
    – Rimfire
    Oct 7, 2019 at 21:48

1 Answer 1

0

The message "Address already in use" says that there is already something listening on that port at the client side.

Try to figure out which client process has port 5901 open by using netstat -antp|grep 5901

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .