SSH log into remote host via auth host
A: local host, B: auth host, C: remote host
double SSH
ssh <userb>@<ipb> -p <portb>
[Enter]<pwdb>
[type :]ssh <userc>@<ipc> -p <portc> [default: 22]
[Enter]<pwdc>
SSH port forward
ssh -L <porta>:<ipc>:<portc> <userb>@<ipb> -p <portb>
[Enter]<pwdb>
[open a new terminal]
ssh <userc>@localhost -p <porta>
[Enter]<pwdc>
Note: If you want to put this terminal to background, append the option “-Nf”]
-f means “Requests ssh to go to background just before command execution.”
-N means “Do not execute a remote command.”
if -N omitted, error occurs “Cannot fork into background without a command to execute.” So you have to imply that no cmd is gonna execute. Only pwd is typed in after the port forward cmd.
After this, you continue to type ssh cmd in local terminal.