How To SSH Into Raspberry Pi | Code Boost
Description: SSH (aka Secure Shell) is a protocol for securely accessing and managing remote computers over a network. It's like having a private tunnel between your computer and your Raspberry...

Article

# How To SSH Into Raspberry Pi

By Matt · Jun 9, 2024

SSH (aka Secure Shell) is a protocol for securely accessing and managing remote computers over a network. It's like having a private tunnel between your computer and your Raspberry Pi. This guide will walk you through the process of SSHing into a Raspberry Pi step-by-step, with additional tips to make it even easier. If you need their documentation, it's here.

### Why Use SSH with Your Raspberry Pi?

- Convenience: Control your Raspberry Pi from anywhere with an internet connection.
- Flexibility: Manage files, install software, and run commands remotely.
- Security: SSH encrypts your connection, keeping your data safe.

### Prerequisites

Before starting, ensure you have the following:

1. Raspberry Pi: Connected to your network via Wi-Fi or Ethernet.
2. Another Computer: This can be a Windows, Mac, or Linux machine.
3. SSH Client:
   - Linux and Mac: Built into the terminal.
   - Windows: Download and install a client like PuTTY.

### Step 1: Enable SSH on Your Raspberry Pi

#### Option 1: With a Monitor and Keyboard

1. Open the Raspberry Pi Configuration menu.
2. Navigate to "Interfaces."
3. Enable SSH.

#### Option 2: Without a Monitor (Headless Setup)

1. Insert the Raspberry Pi's SD card into your computer.
2. In the boot partition of the SD card, make an empty file named ssh (no file extension).

Pro Tip: You can also enable SSH using the command: sudo raspi-config Then, navigate to "Interfacing Options" and enable SSH.

### Step 2: Find Your Raspberry Pi's IP Address

#### Option 1: With a Monitor

1. Open the terminal on your Raspberry Pi.
2. Type:
3. hostname -I
4. This will display your Pi's IP address.

#### Option 2: Without a Monitor (Headless Setup)

1. Log in to your router's admin interface.
2. Look for a list of connected devices to find your Pi's IP address.

Alternative: Use a network scanner tool like Advanced IP Scanner or Angry IP Scanner to locate your Pi's IP.

### Step 3: Connect to Your Raspberry Pi via SSH

#### Linux and Mac

1. Open the terminal.
2. Type:
3. ssh pi@[IP address]
4. Replace [IP address] with your Raspberry Pi's IP.
5. Enter the password (default is raspberry).

#### Windows (Using PuTTY)

1. Open PuTTY.
2. Enter your Pi's IP address in the "Host Name" field.
3. Ensure the port is set to 22.
4. Click "Open."
5. Enter the username (pi) and password (raspberry).

Pro Tip: Save your PuTTY session for quicker access next time.

### Troubleshooting Common Issues

- Connection Refused: Ensure SSH is enabled on your Raspberry Pi and the IP address is correct.
- Authentication Failure: Double-check your username and password. If you've changed the default password, use the updated one.
- Cannot Find IP Address: Confirm your Raspberry Pi is connected to the network and try scanning your network again.

### Advanced Tips

- Change the Default Password:
- passwd
- This improves security.
- Set Up SSH Key Authentication:
  1. Generate an SSH key on your computer:
  2. ssh-keygen
  3. Copy the key to your Raspberry Pi:
  4. ssh-copy-id pi@[IP address]
  5. Now you can log in without entering a password.
- Use a Static IP Address: Configure your Raspberry Pi to always use the same IP address for easier access. Refer to this guide for instructions.

### Next Steps

Congratulations! You've successfully SSHed into your Raspberry Pi. Now you can:

- Install software packages using sudo apt-get install.
- Transfer files using scp or SFTP.
- Run scripts and manage your Raspberry Pi remotely.