**No router + no screen + regular Ethernet cable + RPI 2 + Raspbian Lite 2018-11-13 + Ubuntu 18.10**

First we must enable the SSH server on the Pi, which is disabled by default for security.

If you already have a shell on the Pi through a non-SSH method such as screen + keyboard or UART (see below), just run:

    sudo systemctl enable ssh
    sudo service sshd start

as explained at: https://raspberrypi.stackexchange.com/questions/58478/ssh-not-working-with-fresh-install This persists across boots.

Otherwise, insert he SD card on your host, and create a magic empty file named `ssh` file in the `boot/` partition.

On Ubuntu hosts, it gets mounted automatically and you can do just:

    sudo touch /media/$USER/boot/ssh

which you can confirm with:

    lsblk

which contains:

    mmcblk0     179:0    0  14.4G  0 disk
    ├─mmcblk0p1 179:1    0  43.9M  0 part /media/ciro/boot
    └─mmcblk0p2 179:2    0  14.4G  0 part /media/ciro/rootfs

If you don't enable the SSHD daemon on the Pi then SSH connection will fail with:

    ssh: connect to host 10.42.0.160 port 22: Connection refused

when we try it later on.

**After enabling the SSH server**

Next, boot the Pi, and link an Ethernet cable from your laptop directly to the Pi:

[![enter image description here][1]][1]

On Ubuntu 17.04 to work around [this bug](https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1678606) as mentioned [on this answer](https://raspberrypi.stackexchange.com/questions/67594/unbuntu-17-04-direct-shared-ethernet-connection-fails-with-active-connection-co/72211#72211) you first need:

    sudo apt-get install dnsmasq-base

On the host, open the network manager:

    nm-connection-editor

And go:

1. `+` sign (Add a new connection)
1. Ethernet
1. Create
1. IPv4 Settings
1. Method: Shared to other computers
1. Set a good name for it
1. Save

[![enter image description here][2]][2]

Find the IP of the Pi on host:

    cat /var/lib/misc/dnsmasq.leases

outputs something like:

    1532204957 b8:27:eb:0c:1f:69 10.42.0.160 raspberrypi 01:b8:27:eb:0c:1f:69

`10.42.0.160` is the IP, then as usual:

    ssh [email protected]

I also have the following in my `.bashrc`:

    piip() ( cat /var/lib/misc/dnsmasq.leases | cut -d ' ' -f 3; )
    pissh() ( sshpass -p raspberry ssh "pi@$(piip)"; )

From inside the Pi, notice that it can access the internet normally through your host's other interfaces:

    ping google.com

For example on my laptop, the Pi takes up the Ethernet, but the host is also connected to the internet through WiFi.

The crossover cable is *not* required if the host network card supports [Auto MDI-X](https://en.wikipedia.org/wiki/Medium-dependent_interface#Auto_MDI-X). This is the case for most recent hardware, including for example the 2012 Lenovo T430 I tested with, [which has](https://support.lenovo.com/gb/en/documents/pd024705) an "Intel® 82579LM Gigabit Network Connection" which [documents support for Auto MDI-X](http://www.intel.com/content/dam/doc/datasheet/82579-gbe-phy-datasheet-vol-2-1.pdf).

Now you can also:

- access the Internet from the PI through your Ubuntu's Wifi connection
- open a VNC to get rid of the display as well: https://raspberrypi.stackexchange.com/questions/14611/how-to-set-up-raspberry-pi-without-a-monitor/54393#54393

**UART serial USB converter**

This is an alternative to SSH if you just want to get a shell on the Pi: https://en.wikipedia.org/wiki/Serial_port

This does not use SSH or networking itself, but rather the older, simpler, more direct, more reliable, lower bandwidth, lower distance serial interface. The Pi won't have access to the Internet with this method.

Desktop computers still have a serial port which you can connect directly wire to wire with the Pi, but these are hidden in most laptops, and so we need to buy a cheap USB adapter. Here I've used: https://www.amazon.co.uk/gp/product/B072K3Z3TL See also: https://unix.stackexchange.com/questions/307390/what-is-the-difference-between-ttys0-ttyusb0-and-ttyama0-in-linux/367882#367882 

First plug the SD card on the host, and edit the `config.txt` file present in the first partition to add:

    enable_uart=1

as explained at: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=141195

This first partition contains the bootloader, its configuration files and the (Linux / your) kernel, `config.txt` being one of them. The second partition contains the actual Linux root filesystem.

Now connect your computer to the Pi as:

[![enter image description here][13]][13]

You only need to attach 3 cables:

- Ground to Ground
- Tx on Pi to Rx on the USB to serial port
- Rx on Pi to Tx on tye USB to serial port

This is also documented at: https://www.raspberrypi.org/documentation/usage/gpio/README.md

Be careful not to link the Ground to the 5V, I've already burned 2 UART to USB chips by doing that!

You don't need to connect the 5V to the 5V at all. I think you can power your Pi like that, but I've read that this is a bad idea, just use the usual USB power source.

Finally, plug the USB side of the connector to your host computer, and get a shell with:

    sudo apt install screen
    sudo usermod -a -G dialout $USER
    screen /dev/ttyUSB0 115200

Exit with `Ctrl-A \`.

Here is a video by Adafruit showing it: https://www.youtube.com/watch?v=zUBPeoLW16Q

**See also**

Similar question on Stack Overflow: https://stackoverflow.com/questions/16040128/hook-up-raspberry-pi-via-ethernet-to-laptop-without-router

  [1]: https://i.sstatic.net/8C0mJ.jpg
  [2]: https://i.sstatic.net/ZU18R.png
  [13]: https://i.sstatic.net/L0XyU.jpg