0
0
Linux CLIscripting~10 mins

SSH tunneling (port forwarding) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to create a local SSH tunnel forwarding port 8080.

Linux CLI
ssh -L [1] user@remote_host
Drag options to blanks, or click blank then click option'
A-N
B8080:localhost:80
C-R 8080:localhost:80
D-p 22
Attempts:
3 left
💡 Hint
Common Mistakes
Using -R instead of -L for local forwarding.
Forgetting to specify the port mapping format.
2fill in blank
medium

Complete the command to create a remote SSH tunnel forwarding remote port 9090 to local port 3000.

Linux CLI
ssh [1] 9090:localhost:3000 user@remote_host
Drag options to blanks, or click blank then click option'
A-R
B-L
C-N
D-p
Attempts:
3 left
💡 Hint
Common Mistakes
Using -L instead of -R for remote forwarding.
Mixing up local and remote ports.
3fill in blank
hard

Fix the error in the SSH command to forward local port 5000 to remote port 80.

Linux CLI
ssh -L 5000:localhost:[1] user@remote_host
Drag options to blanks, or click blank then click option'
A80
B22
C443
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using SSH port 22 instead of the service port.
Using an unrelated port number.
4fill in blank
hard

Fill both blanks to create a command that forwards local port 3306 to remote MySQL port 3306 and runs without opening a shell.

Linux CLI
ssh [1] [2] user@remote_host
Drag options to blanks, or click blank then click option'
A-L 3306:localhost:3306
B-N
C-p 22
D-R 3306:localhost:3306
Attempts:
3 left
💡 Hint
Common Mistakes
Using -R instead of -L for local forwarding.
Forgetting -N to keep the session quiet.
5fill in blank
hard

Fill all three blanks to create a command that forwards remote port 5432 to local port 5432, uses port 2222 for SSH, and runs without executing remote commands.

Linux CLI
ssh [1] [2] [3] user@remote_host
Drag options to blanks, or click blank then click option'
A-R 5432:localhost:5432
B-p 2222
C-N
D-L 5432:localhost:5432
Attempts:
3 left
💡 Hint
Common Mistakes
Using -L instead of -R for remote forwarding.
Omitting the SSH port option.
Not using -N to prevent remote shell.