If I set up "forwarding" with sshuttle as

myserver:~$ sshuttle -r username@TARGET

Will I be still able to ssh into myserver from mymachine? I guess not, but I am afraid to try.

Alternatively if I forward just port 22

myserver:~$ ssh -nNT -L TARGET

Is there a way to ssh into myserver? Or in case you want to do that, you need to open extra port for ssh?

2 Answers 2


ssh someserver -R 10022: -fN will allow you to ssh to your machine directly on port 22, and on someserver on port 10022, which will direct you to your server on port 22.

That is so because the daemon keeps listening on the port it's configured to listen to, and because it can maintenance more than one simultaneous ssh sessions (of course assuming that you haven't limited that in your sshd_config).


On a second look it seems you are trying to use these tools designed for a client from your server "myserver". My answer covers the situation where you are using them on the client, "mymachine".

The documentation for this sshuttle project seems rather unorthodox: even the How it works article tells only what it does. It compares the project to other tools mainly by telling how it doesn't work: it's not "like" a SSH port forward but it's not "like" a "stupid/complex VPN" either. Apparently the author seems to think he has invented something all new and of course better than anyone else has before.

What we can tell based on short read through of the documentation (requirements, usage) is that it

  • can proxy all traffic to the other side, using iptables (NAT) or recmsg (TPROXY)
  • doesn't need admin access on the remote server, but root access on the client machine
  • utilizes Python on both ends.

Based on that, also SSH to the remote side might get proxied, but that shouldn't matter, because you can probably ssh from the remote server to itself using the external IP address; it doesn't make any difference from which side of the tunnel the connection originates.

I don't know what you are trying to do with your alternative solution as it's not even trying to achieve the same results than the first one. However, you can't bind to local port 22 unless you are root and there isn't sshd already listening. Even if you succeed, I can't see how this adds anything useful. But, to answer the question: yes, you can still ssh to remote:22 (+ the local port forwarded).

  • Ad sshuttle -> I guess the purpose of the tool was to route/forward all incoming traffic from myserver to TARGET
    – redacted
    Jun 5, 2017 at 13:57
  • Ad ssh port forwarding: This has nothing to do with sshuttle. I agree the question is asked in a confusing way (2 in 1), sorry for that. I am learning about networking and the topic of forwarding and traffic routing has been bugging me. What I meant was more like a curiosity rather than practical thing. I was not sure that if I forward -p 22 from myserver to TARGET, then when I runssh myserver I am essentially connecting to TARGET. So how could I ssh to myserver if all traffic is sent staright to TARGET
    – redacted
    Jun 5, 2017 at 14:01
  • 1
    The sshuttle is for situations where you need VPN without installing VPN. It puts all your traffic into the SSH connection, protecting you from the possibly hostile local environment and making you appear as your server to the outside world. So you got its purpose wrong. Jun 5, 2017 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.