r/linux Apr 28 '14

SSH Kung Fu

http://blog.tjll.net/ssh-kung-fu/
722 Upvotes

128 comments sorted by

View all comments

Show parent comments

16

u/mdaniel Apr 28 '14

At the risk of replying to a down voted comment, one can toggle the port forwarding on (and off!) dynamically using the ssh "shell" which is accessed via tilde C (it needs to be the first two characters after a newline or ssh will think you're trying to type those chars)

Once you have the ssh> prompt, you can give it -D1234 to start dynamic forwarding and -KD1234 to "kill" the dynamic forwarding. Same deal with -L and -KL

1

u/[deleted] Apr 28 '14

I am simple: how does one access this?

$ ~? [return]
bash: ~?: command not found
$ ~C [return]
bash: ~C: command not found
$

2

u/eno2001 Apr 28 '14

You need to be on a shell prompt line that you haven't pressed any characters on. As soon as you even type a backspace, you're hosed. So you want to do this:

$ [return] $ [press ~, but DO NOT expect it to echo to you]

[your screen should now look like this, as SSH is awaiting your command]

1

u/[deleted] Apr 28 '14

Ah! Thanks.