Access Your Raspberry Pi Anywhere Using SSH and VNC
Learn how to connect remotely to your Raspberry Pi using SSH and VNC. …
Updated October 7, 2023
Learn how to connect remotely to your Raspberry Pi using SSH and VNC. SSH (Secure Shell) and VNC (Virtual Network Computing) are two methods that allow you to access your Raspberry Pi from anywhere with an internet connection. This guide will show you how to set up both.
Setting Up SSH
- Enable SSH on Your Raspberry Pi:
- Open the terminal and type
sudo raspi-config
. - Navigate to “Interfacing Options” and select “SSH”.
- Choose “Yes” to enable the SSH server, then exit raspi-config.
- Find Your Raspberry Pi’s IP Address:
- Open a terminal on your Raspberry Pi and type
hostname -I
. This will display your device’s local IP address.
- Connect to Your Raspberry Pi from Another Computer:
- On the remote computer, open a terminal or SSH client (like PuTTY for Windows).
- Enter the command
ssh pi@<your_raspberry_pi_ip_address>
. Replace<your_raspberry_pi_ip_address>
with your Raspberry Pi’s IP address. - When prompted, enter the default password “raspberry”. You can change this later by typing
passwd
in the terminal.
- Transfer Files to and From Your Raspberry Pi:
- To copy files from your remote computer to the Raspberry Pi, use the command
scp <local_file> pi@<your_raspberry_pi_ip_address>:~/<destination_directory>
. For example,scp myfile.txt pi@192.168.0.10:~/
will copy a file named “myfile.txt” to the home directory of your Raspberry Pi. - To copy files from the Raspberry Pi to your remote computer, use the command
scp pi@<your_raspberry_pi_ip_address>:~/<source_directory>/<filename> <local_destination>
. For example,scp pi@192.168.0.10:~/myfile.txt ~/Downloads/
will copy a file named “myfile.txt” from the Raspberry Pi to your computer’s Downloads folder.
Setting Up VNC
- Install VNC Server on Your Raspberry Pi:
- Open the terminal and type
sudo apt-get install tightvncserver
.
- Set a Password for Your VNC Server:
- Type
tightvncserver
to start the server. - Choose a password when prompted, then confirm it.
- Find Your Raspberry Pi’s IP Address (if you haven’t already):
- Open a terminal on your Raspberry Pi and type
hostname -I
. This will display your device’s local IP address.
- Connect to Your Raspberry Pi from Another Computer:
- On the remote computer, download and install a VNC client (like TightVNC for Windows).
- Open the VNC client and enter the command
pi@<your_raspberry_pi_ip_address>
. Replace<your_raspberry_pi_ip_address>
with your Raspberry Pi’s IP address. - Enter the password you set earlier when prompted. You can also change the display settings if needed, then click “OK”.
- Remote Control Your Raspberry Pi:
- The VNC client should now show your Raspberry Pi’s desktop. You can control it remotely just like you would with a monitor and keyboard.
Now you can access your Raspberry Pi from anywhere using SSH or VNC. Enjoy the convenience of remote access!