Connect to server.example.test and forward a remote X11 application to the local display.
Choose ordinary X11 forwarding rather than trusted X11 (-Y).
Which command is appropriate?
ssh -X enables X11 forwarding with restrictions; -Y enables trusted X11 with weaker security restrictions, while -A forwards the authentication agent.
Detailed explanation
ssh -L server.example.testIncorrect. -L is local TCP forwarding and its arguments are incomplete.
Incorrect. -L is local TCP forwarding and its arguments are incomplete.
ssh -X server.example.testCorrect. It enables ordinary, untrusted X11 forwarding.
Correct. It enables ordinary, untrusted X11 forwarding.
ssh -Y server.example.testIncorrect. -Y enables trusted X11 forwarding.
Incorrect. -Y enables trusted X11 forwarding.
ssh -A server.example.testIncorrect. -A enables authentication-agent forwarding.
Incorrect. -A enables authentication-agent forwarding.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-X=X11 forwarding' '-Y=trusted X11 forwarding' '-A=agent forwarding' '-L=local TCP forwarding'Expected result
-X=X11 forwarding
-Y=trusted X11 forwarding
-A=agent forwarding
-L=local TCP forwardingKey points
- -X is X11 forwarding
- -Y is trusted X11
- -A is agent forwarding
Notes
- Environment: OpenSSH forwarding option対応表
- 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.