0
0
Raspberry Piprogramming~10 mins

Remote access with SSH in Raspberry Pi - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to connect to a Raspberry Pi using SSH.

Raspberry Pi
ssh [1]@192.168.1.10
Drag options to blanks, or click blank then click option'
Api
Broot
Cadmin
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'root' or 'admin' as username which are not default for Raspberry Pi.
Omitting the username before the @ symbol.
2fill in blank
medium

Complete the command to specify a custom SSH port 2222 when connecting.

Raspberry Pi
ssh -p [1] pi@192.168.1.10
Drag options to blanks, or click blank then click option'
A22
B80
C443
D2222
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default port 22 instead of the custom port 2222.
Confusing port numbers with common web ports like 80 or 443.
3fill in blank
hard

Fix the error in the SSH command to copy a file to the Raspberry Pi.

Raspberry Pi
scp myfile.txt [1]192.168.1.10:/home/pi/
Drag options to blanks, or click blank then click option'
Api
Bpi@
Cpi:/
D@pi
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the '@' symbol after the username.
Placing '@' in the wrong position.
4fill in blank
hard

Fill in the blank to create a dictionary comprehension that maps hostnames to their IPs if the IP starts with '192'.

Raspberry Pi
hosts = {name: ip for name, ip in devices.items() if ip.[1]('192')}
Drag options to blanks, or click blank then click option'
Acontains
Bendswith
Cstartswith
Dequals
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'endswith' or 'contains' which do not check the start of the string.
Using 'equals' which requires exact match.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps usernames to their home directories if the directory path contains '/home'.

Raspberry Pi
user_dirs = { [1] : [2] for [1], [2] in [3].items() if '/home' in [2] }
Drag options to blanks, or click blank then click option'
Auser
Bdirectory
Cuser_dir
Dusers
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable names that don't match the loop variable.
Not checking the directory string correctly.