📜  raspberry pi ssh headless (1)

📅  最后修改于: 2023-12-03 15:19:42.644000             🧑  作者: Mango

Raspberry Pi SSH Headless

Raspberry Pi is a powerful and versatile single-board microcomputer. However, setting it up can be intimidating, especially for beginners. If you don't have a spare monitor, keyboard, and mouse lying around, you might wonder how you can set it up.

Fortunately, Raspberry Pi supports headless setup, which means you can access it remotely without needing any additional hardware. And the easiest way to do that is by using SSH (Secure Shell) protocol.

Requirements

Before we begin, make sure you have the following:

  • Raspberry Pi with a clean installation of Raspberry Pi OS.
  • A computer with an SSH client installed. For Windows, you can download PuTTY. For macOS or Linux, you can use the built-in Terminal app.
  • Access to your Wi-Fi router or an Ethernet cable.
Enable SSH

By default, SSH is disabled on Raspberry Pi OS for security reasons. However, you can enable it with the following steps:

  1. Insert the microSD card with Raspberry Pi OS into your computer.
  2. In the boot partition, create an empty file named ssh (without any extension).
  3. Safely eject the microSD card and insert it into your Raspberry Pi.
Connect to Raspberry Pi via SSH

Now that SSH is enabled, you can connect to your Raspberry Pi from your computer. Here's how:

  1. Find the IP address of your Raspberry Pi. You can do this by logging in to your Wi-Fi router and looking for devices connected to it. Alternatively, you can use tools like nmap or Angry IP Scanner to scan your network for Raspberry Pi's IP address.
  2. Open your SSH client and enter the IP address of your Raspberry Pi.
  3. When prompted, enter the default username pi and the password raspberry.
  4. You should now be connected to your Raspberry Pi via SSH!
Customizing SSH

For security reasons, it's recommended to change the default username and password for SSH. You can also configure other options such as enabling public-key authentication, disabling password authentication, and more. To do this, edit the SSH configuration file located at /etc/ssh/sshd_config.

Conclusion

SSH is a powerful tool that allows you to remotely access and manage your Raspberry Pi without needing any physical peripherals. With the simple steps outlined above, you can easily set up Raspberry Pi headless and start experimenting with your projects. Happy hacking!