Command line hangs when trying to make ssh tunnel

Posted June 14, 2021 246 views
UbuntuMiscellaneousUbuntu 20.04

I was following this tuitorial and was on step 3. Now as I try to make the ssh tunnel, my command line gets stuck when I enter the password. It doesn’t terminate or show any error but just gets stuck

I used
ssh -L 59000:localhost:5901 -C -N -l sammy your_server_ip
command from my local system(Windows).
I replaced sammy by my non-root username and yourserverip with the linux server ip address.
It asks for my password, I provide it and then the command line gets stuck.
Any help is appreciated, thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

I believe that this is the expected behavior. That way you open a tunnel which is available for your current session, then by pressing CTRL+C the tunnel will be terminated.

If you want to SSH to the host, you could omit the -C and the -N flags.

Hope that this helps.