Connect Remotely to Raspberry Pi

In this tutorial I will show you how to connect remotely to your Raspberry Pi from your PC or Mac.

After you first start the Raspberry you don’t need to let it constantly connected with mouse, keyboard and monitor – you can control it remotely using your Mac or PC. For this tutorial leave only the LAN cable and power supply connected. Of course you also have to power up the Raspberry. Once the green leds are on you can start with the remote connection.

Enable SSH on Raspbian

As of the November 2016 release, Raspbian has the SSH server disabled by default. It can be enabled:

Manually from the desktop

  1. Launch Raspberry Pi Configuration from the Preferences menu
  2. Navigate to the Interfaces tab
  3. Select Enabled next to SSH
  4. Click OK

Alternatively, raspi-config can be used

  1. Enter sudo raspi-config in a terminal window
  2. Select Interfacing Options
  3. Navigate to and select SSH
  4. Choose Yes
  5. Select Ok
  6. Choose Finish

For headless setup

SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.

Connect with PC

PuTTY is a free SSH client for Windows. Download the executable (putty.exe) from the official page.

Start PuTTY. Enter the IP of your Raspberry under “Host Name(or IP address)” and leave the port to 22. Now press the “Open” button.

putty-config

In the next screen enter your username and password.

Default Raspbian user is: pi

and the password is: raspberry

putty-login

That’s it! You are now connected and you can execute whatever linux command you like.

Note: I recommend to assign a static IP to your Raspberry from your router. This way you don’t have to check for the IP of the Raspberry each time the router assigns a new one to it.




Transfer Files between PC and Raspberry Pi

Another useful tool I want to show you is WinSCP. It is a secure FTP client giving you the ability to transfer files from or to your Raspberry Pi.

You can download WinSCP from the official project website.

winscp-raspberry

Once downloaded and installed, type in the IP, username and password of your Raspberry and hit the “Login” button.

Connect from Mac

Open Terminal and type in:

ssh pi@192.168.1.134

You will be prompted for a password to enter.

Don’t forget to replace here pi@192.168.1.134 the username pi (if you have cahnged it) and the IP with your current Raspberry Pi IP

 

 

0 0 votes
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments