0
0
Raspberry Piprogramming~5 mins

Remote access with SSH in Raspberry Pi

Choose your learning style9 modes available
Introduction

SSH lets you control your Raspberry Pi from another computer safely over the internet or local network.

You want to run commands on your Raspberry Pi without a monitor or keyboard.
You need to transfer files between your computer and Raspberry Pi securely.
You want to manage your Raspberry Pi while it is in a different room or location.
You are setting up your Raspberry Pi headlessly (without screen).
You want to remotely troubleshoot or update your Raspberry Pi.
Syntax
Raspberry Pi
ssh username@ip_address

username is the Raspberry Pi user, usually pi.

ip_address is the Raspberry Pi's network address, like 192.168.1.10.

Examples
Connects to Raspberry Pi with user pi at IP 192.168.1.10.
Raspberry Pi
ssh pi@192.168.1.10
Connects using port 2222 instead of default port 22.
Raspberry Pi
ssh -p 2222 pi@192.168.1.10
Connects using a private key file for passwordless login.
Raspberry Pi
ssh -i ~/.ssh/id_rsa pi@192.168.1.10
Sample Program

This example shows how to start an SSH session to your Raspberry Pi, list files, show current folder, and then exit.

Raspberry Pi
# On your computer terminal, type:
ssh pi@192.168.1.10

# After connecting, you can run commands like:
ls
pwd
exit
OutputSuccess
Important Notes

Make sure SSH is enabled on your Raspberry Pi (use sudo raspi-config to enable it).

You need to know your Raspberry Pi's IP address on the network (use hostname -I on the Pi).

For security, change the default password of the pi user.

Summary

SSH lets you control your Raspberry Pi remotely and securely.

Use ssh username@ip_address to connect from your computer.

Enable SSH on the Pi and know its IP address before connecting.