ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 187 - XK0-005 discussion

Report
Export

An administrator would like to securely connect to a server and forward port 8080 on a local machine to port 80 on the server. Which of the following commands should the administrator use to satisfy both requirements?

A.
ssh ---L 8080: localhost:80 admin@server
Answers
A.
ssh ---L 8080: localhost:80 admin@server
B.
ssh ---R 8080: localhost:80 admin@server
Answers
B.
ssh ---R 8080: localhost:80 admin@server
C.
ssh ---L 80 : localhost:8080 admin@server
Answers
C.
ssh ---L 80 : localhost:8080 admin@server
D.
ssh ---R 80 : localhost:8080 admin@server
Answers
D.
ssh ---R 80 : localhost:8080 admin@server
Suggested answer: A

Explanation:

This command will create a local port forwarding, which means that connections from the SSH client are forwarded via the SSH server, then to a destination server. In this case, the destination server is the same as the SSH server (localhost), and the destination port is 80. The SSH client will listen on port 8080 on the local machine, and any connection to that port will be forwarded to port 80 on the server. This way, the administrator can securely access the web service running on port 80 on the server by using http://localhost:8080 on the local machine.

The other options are incorrect because:

B) ssh -R 8080:localhost:80 admin@server

This command will create a remote port forwarding, which means that connections from the SSH server are forwarded via the SSH client, then to a destination server. In this case, the destination server is the same as the SSH client (localhost), and the destination port is 80. The SSH server will listen on port 8080 on the remote machine, and any connection to that port will be forwarded to port 80 on the client. This is not what the administrator wants to do.

C) ssh -L 80:localhost:8080 admin@server

This command will also create a local port forwarding, but it will use port 80 on the local machine and port 8080 on the server. This is not what the administrator wants to do, and it may also fail if port 80 is already in use by another service on the local machine.

D) ssh -R admin@server

This command is incomplete and invalid. It does not specify any port numbers or destination addresses for the remote port forwarding. It will also fail if the SSH server does not allow remote port forwarding.

CompTIA Linux+ Certification Exam Objectives

How to Set up SSH Tunneling (Port Forwarding)

asked 02/10/2024
Albert Hidalgo Bassons
45 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first