0
0
Linux CLIscripting~10 mins

Key-based authentication 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 code to generate a new SSH key pair.

Linux CLI
ssh-keygen -t [1] -f ~/.ssh/id_rsa
Drag options to blanks, or click blank then click option'
Aed25519
Brsa
Cecdsa
Ddsa
Attempts:
3 left
💡 Hint
Common Mistakes
Using dsa which is outdated and less secure.
Using rsa without specifying key size.
2fill in blank
medium

Complete the command to copy your public key to the remote server for passwordless login.

Linux CLI
ssh-copy-id -i ~/.ssh/id_rsa.pub [1]@remote_host
Drag options to blanks, or click blank then click option'
Aroot
Bguest
Cadmin
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using root without permission.
Using guest which may not have SSH access.
3fill in blank
hard

Fix the error in the SSH config file to specify the private key file.

Linux CLI
Host remote
  HostName example.com
  User user
  IdentityFile [1]
Drag options to blanks, or click blank then click option'
A~/.ssh/id_rsa
B~/.ssh/config
C~/.ssh/authorized_keys
D~/.ssh/id_rsa.pub
Attempts:
3 left
💡 Hint
Common Mistakes
Using the public key file instead of the private key.
Using unrelated files like config.
4fill in blank
hard

Fill both blanks to create a directory and set correct permissions for SSH keys.

Linux CLI
mkdir -p ~/.ssh && chmod [1] ~/.ssh && chmod [2] ~/.ssh/id_rsa
Drag options to blanks, or click blank then click option'
A700
B600
C755
D644
Attempts:
3 left
💡 Hint
Common Mistakes
Setting 755 on private keys, making them world-readable.
Setting 644 on the .ssh directory.
5fill in blank
hard

Fill all three blanks to create an SSH config entry for a server with a custom port and identity file.

Linux CLI
Host myserver
  HostName [1]
  Port [2]
  IdentityFile [3]
Drag options to blanks, or click blank then click option'
A192.168.1.100
B2222
C~/.ssh/my_custom_key
Dexample.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using the public key file for IdentityFile.
Using default port 22 when a custom port is required.