3

I have a Raspberry Pi 3 model B. I already have Raspbian on a SD card. I have a MacBook Pro without an Ethernet and I don't have the Ethernet adaptor, I have no access to router. I want to connect to my RPi using SSH or VNC but I don't know my RPi IP address and I can't connect it to WiFi.

I need to connect RPi with following:

  • RPi 3 model B
  • SD card with Raspbian
  • MacBook Pro without Ethernet

What do I need to do to connect RPi to Mac?

techraf
  • 4,254
  • 10
  • 29
  • 41
PyRe
  • 133
  • 1
  • 5
  • All you have told us is you can't do lots of common things. You have provided no actual information. – Milliways Dec 07 '16 at 01:29
  • You have no router? Oh.... kay.... ??? Just go and buy a cheap ethernet cable and configure DHCP on your Mac. Or setup static IP's (but you need to connect keyboard and screen on Pi to do that) Other than that its like saying. "I got a satellite dish and a TV.. but no decoder" – Piotr Kula Dec 07 '16 at 08:00
  • You said you have no ethernet cable and no internet access. It is virtually impossible to then SSH or VNC. – LilVinny Dec 06 '16 at 23:38
  • No, i have internet access but i don't have physically access to router to use Ethernet cable. – PyRe Dec 07 '16 at 08:05

1 Answers1

5

Assuming you have no hardware connectors, your only point of control is the SD card.

Depending on your current state you might need all or some of the below steps:

  1. You need to take it out of the Pi and insert into Mac's slot.

    Now you need to mount the filesystem on the SD card. OS X doesn't support it natively, so either you need a Linux virtual machine running in VirtualBox (how to set up virtual machine and mount the SD card is a separate topic), or you need to install software that recognizes ext filesystem (like a free OSXFuse or a commercial Paragon ExtFS for Mac).

  2. Once you have access to the filesystem, you need to edit/make sure the <mountpointforroot>/etc/wpa_supplicant/wpa_supplicant.conf file contains the correct WiFi connection settings:

    network={
      ssid="wifiNetworkId"
      psk="wifiNetworkLey"
      id_str="wifiNetworkId"
    }
    
  3. If you are using November 2016 Raspbian release, you need to ensure the boot partition contains ssh file (see this)

  4. Now you need to unmount the SD card from Mac and boot the Pi

  5. You need to figure out the IP address that Pi obtained from the access point's DHCP.

    As you cannot check it directly on the router, you can use nmap to scan for devices listening on SSH port, for example:

    nmap -p 22 192.168.1.0/24
    

    You need to replace 192.168.1.0 with your network (this should be the same as for your Mac connected to the same WiFi).

    nmap is not installed on OS X, but you can install it, for example with Homebrew (brew install nmap). For Homebrew itself check the official guide.

  6. Check the new IP address of the Pi and connect to it, for example:

    ssh pi@192.168.1.55
    
techraf
  • 4,254
  • 10
  • 29
  • 41
  • when i'm trying to save `wpa_supplicant.conf` i got permission error: `E212: Can't open file for writing`. – PyRe Dec 07 '16 at 07:41
  • (1) Try with `sudo` (2) you give no hint how you mounted the filesystem or anything, how am I supposed to know? – techraf Dec 07 '16 at 07:43
  • I insert SD card in SD slot, boot and 15 GB Volume are mounted in on ubuntu (running on Parallel Desktop). the filesystems are there. i try to edit `wpa_supplicant.conf` with `vim` but i couldn't save it. – PyRe Dec 07 '16 at 07:53
  • And the result of (1)? – techraf Dec 07 '16 at 07:54
  • what do you mean by `sudo`? where i have to use it? – PyRe Dec 07 '16 at 07:56
  • Run the editor with `sudo` command. Or otherwise use `root` account to edit it. This file is not writeable by everyone. – techraf Dec 07 '16 at 08:00