The SSH config file simplifies connecting to remote servers by storing connection details like hostname, user, and port. It lets you use short names instead of full commands.
Click to reveal answer
beginner
Which file path is the default SSH config file for a user?
The default SSH config file for a user is ~/.ssh/config. It stores personal SSH connection settings.
Click to reveal answer
beginner
What does the Host keyword do in an SSH config file?
The Host keyword defines a shortcut name for a remote server. You use this name with the ssh command instead of typing the full hostname and options.
Click to reveal answer
beginner
How do you specify a custom SSH port in the config file?
Use the Port option under a Host entry to set a custom port number for SSH connections to that host.
Click to reveal answer
beginner
Give an example of a simple SSH config entry for a server named 'myserver'.
Example:
Host myserver
HostName 192.168.1.10
User alice
Port 2222
This lets you connect by typing ssh myserver.
Click to reveal answer
Where is the SSH config file usually located for a user?
A~/.ssh/config
B/etc/ssh/ssh_config
C/var/ssh/config
D/usr/local/ssh/config
✗ Incorrect
The personal SSH config file is stored at ~/.ssh/config for each user.
What keyword starts a new host entry in the SSH config file?
AServer
BHost
CMachine
DConnect
✗ Incorrect
The 'Host' keyword defines a shortcut name for a server.
How do you specify the username for SSH in the config file?
AAccount
BUsername
CLogin
DUser
✗ Incorrect
The 'User' option sets the username for the SSH connection.
If your SSH server listens on port 2222, how do you set this in the config file?
APort 22
BListenPort 2222
CPort 2222
DServerPort 2222
✗ Incorrect
Use 'Port 2222' under the host entry to specify the custom port.
What command lets you connect using the shortcut name defined in the SSH config file?
Assh shortcut
Bssh -c shortcut
Cssh connect shortcut
Dssh -host shortcut
✗ Incorrect
Simply use 'ssh shortcut' to connect using the config file alias.
Explain how an SSH config file can make connecting to servers easier.
Think about how you avoid typing long commands every time.
You got /5 concepts.
Describe the structure of a basic SSH config file entry.
What keywords and values do you write for each server?
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of the Host entry in an SSH config file?
easy
A. To specify the password for the SSH connection
B. To create a shortcut name for an SSH connection
C. To list all IP addresses allowed to connect
D. To define the encryption method used
Solution
Step 1: Understand the role of Host in SSH config
The Host keyword defines a shortcut name for a server, so you can connect using that name instead of typing full details.
Step 2: Compare options
Options B, C, and D do not describe the purpose of Host. Passwords and encryption are handled differently, and allowed IPs are not set here.
Final Answer:
To create a shortcut name for an SSH connection -> Option B
Quick Check:
Host = shortcut name [OK]
Hint: Remember: Host = shortcut name for SSH [OK]
Common Mistakes:
Thinking Host sets password
Confusing Host with IP address list
Assuming Host defines encryption
2. Which of the following is the correct syntax to specify a custom port in an SSH config file?
easy
A. Port: 2222
B. SetPort 2222
C. port=2222
D. Port 2222
Solution
Step 1: Recall SSH config syntax rules
SSH config uses keyword followed by a space and then the value, without colons or equals signs.
Step 2: Check each option
Port 2222 matches the correct syntax: Port 2222. Options A, C, and D use invalid syntax.
Final Answer:
Port 2222 -> Option D
Quick Check:
Keyword + space + value = correct syntax [OK]
Hint: Use space, no colon or equals in SSH config lines [OK]
Common Mistakes:
Using colon after keyword
Using equals sign instead of space
Inventing keywords like SetPort
3. Given this SSH config snippet:
Host myserver
HostName 192.168.1.10
User alice
Port 2200
What command will connect to the server using this config?
medium
A. ssh myserver
B. ssh alice@192.168.1.10 -p 2200
C. ssh 192.168.1.10
D. ssh -p 22 myserver
Solution
Step 1: Understand the config usage
The config defines a shortcut myserver with hostname, user, and port. Using ssh myserver applies all these automatically.
Step 2: Analyze options
ssh myserver uses the shortcut. ssh alice@192.168.1.10 -p 2200 manually specifies user and port but bypasses the config shortcut. ssh 192.168.1.10 misses user and port. ssh -p 22 myserver uses wrong port.
Final Answer:
ssh myserver -> Option A
Quick Check:
Use shortcut name to connect with config settings [OK]
Hint: Use the Host shortcut name to connect easily [OK]
Common Mistakes:
Ignoring the shortcut and typing full command
Using default port 22 instead of configured port
Missing the username from config
4. You wrote this SSH config:
Host test
HostName 10.0.0.5
User bob
Port 22
IdentityFile ~/.ssh/id_rsa_test
But when you run ssh test, it asks for a password instead of using the key. What is the likely problem?
medium
A. The User should be root, not bob
B. The Port 22 is wrong and should be 2222
C. The IdentityFile path is incorrect or not expanded
D. The HostName must be an IP, not a hostname
Solution
Step 1: Check IdentityFile usage
The IdentityFile path uses ~ which may not expand correctly in SSH config. It should be the full path or use $HOME.
Step 2: Evaluate other options
Port 22 is default and usually correct. User 'bob' is valid if correct user. HostName as IP is valid. So the key problem is likely the path expansion.
Final Answer:
The IdentityFile path is incorrect or not expanded -> Option C
Quick Check:
Use full path for IdentityFile to avoid key not used [OK]
Hint: Use full path, not ~, for IdentityFile in SSH config [OK]
Common Mistakes:
Assuming port 22 is always wrong
Changing user without reason
Confusing hostname format
5. You want to create an SSH config entry that connects to multiple servers with the same user and key but different hostnames. Which is the best way to write this?
hard
A. Host server1 server2 server3\n User admin\n IdentityFile ~/.ssh/admin_key
B. Host server*\n User admin\n IdentityFile ~/.ssh/admin_key
C. Host *\n User admin\n IdentityFile ~/.ssh/admin_key
D. Host server1\n User admin\n IdentityFile ~/.ssh/admin_key\nHost server2\n User admin\n IdentityFile ~/.ssh/admin_key\nHost server3\n User admin\n IdentityFile ~/.ssh/admin_key
Solution
Step 1: Understand grouping hosts in SSH config
You can list multiple hostnames after one Host keyword to apply the same settings to all.
Step 2: Compare options
Host server1 server2 server3\n User admin\n IdentityFile ~/.ssh/admin_key lists all servers in one line, applying user and key once. Host server*\n User admin\n IdentityFile ~/.ssh/admin_key uses wildcard which may match unintended hosts. Host *\n User admin\n IdentityFile ~/.ssh/admin_key applies to all hosts, not just these servers. Host server1\n User admin\n IdentityFile ~/.ssh/admin_key\nHost server2\n User admin\n IdentityFile ~/.ssh/admin_key\nHost server3\n User admin\n IdentityFile ~/.ssh/admin_key repeats same settings multiple times, which is redundant.
Final Answer:
Host server1 server2 server3
User admin
IdentityFile ~/.ssh/admin_key -> Option A
Quick Check:
List multiple hosts after one Host for shared settings [OK]
Hint: List multiple hosts after one Host line to share settings [OK]
Common Mistakes:
Using wildcard * too broadly
Repeating same block for each host
Using Host * which applies to all hosts
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.