Create a listener on the SSH server for localhost:9000 and forward it to web.example.test:80, which the client can reach.
Which specification is appropriate?
-R remote_port:destination:destination_port creates a listener on the SSH server side.
Detailed explanation
ssh -L 9000:web.example.test:80 trainee@gateway.example.testIncorrect. -L creates a client-side listener, not a server-side one.
Incorrect. -L creates a client-side listener, not a server-side one.
ssh -R 9000:web.example.test:80 trainee@gateway.example.testCorrect. -R creates the remote listener and sends connections to the client-side destination.
Correct. -R creates the remote listener and sends connections to the client-side destination.
ssh -D 9000:web.example.test:80 trainee@gateway.example.testIncorrect. -D is for a SOCKS proxy and does not express this fixed destination.
Incorrect. -D is for a SOCKS proxy and does not express this fixed destination.
ssh -p 9000 web.example.test trainee@gateway.example.testIncorrect. -p selects the SSH connection port.
Incorrect. -p selects the SSH connection port.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s\n' 'ssh -R 9000:web.example.test:80 trainee@gateway.example.test'Expected result
ssh -R 9000:web.example.test:80 trainee@gateway.example.testKey points
- -R
- Remote-side listener
- Difference from -L
Notes
- Environment: OpenSSH port forwardingの構文確認
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.