Challenge - 5 Problems
SSH Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of SSH command with remote script
What is the output of this bash script that uses SSH to run a remote command?
Bash Scripting
ssh user@remotehost 'echo Hello from $(hostname)'Attempts:
2 left
💡 Hint
The command runs on the remote host, so hostname is evaluated there.
✗ Incorrect
The $(hostname) runs on the remote machine, so the output shows the remote hostname.
📝 Syntax
intermediate2:00remaining
Correct SSH key usage in bash script
Which option correctly uses an SSH private key file to connect to a remote server in a bash script?
Attempts:
2 left
💡 Hint
The correct option uses the -i flag for identity file.
✗ Incorrect
The -i option specifies the private key file for SSH authentication.
🔧 Debug
advanced2:00remaining
Why does this SSH command fail?
This bash script tries to copy a file to a remote server using SSH and SCP but fails. Why?
scp /local/path/file.txt user@remotehost:/remote/path/
Options:
Attempts:
2 left
💡 Hint
Check permissions and existence of remote directory.
✗ Incorrect
If the remote directory does not exist or user lacks write permission, scp fails.
🚀 Application
advanced2:00remaining
Automate running multiple commands over SSH
You want to run these two commands on a remote server via SSH in one connection:
1. cd /var/log
2. ls -l
Which option correctly does this in a bash script?
Attempts:
2 left
💡 Hint
Separate commands with semicolon or && to run sequentially.
✗ Incorrect
Using semicolon or && runs commands sequentially; pipe (|) sends output of first as input to second.
🧠 Conceptual
expert2:00remaining
Understanding SSH agent forwarding security
What is the main security risk of enabling SSH agent forwarding when automating remote commands?
Attempts:
2 left
💡 Hint
Agent forwarding allows remote servers to use your keys temporarily.
✗ Incorrect
Agent forwarding lets the remote server use your SSH keys to connect elsewhere, so if compromised, it can misuse your keys.