1 month ago
160 Views

How to Log into Your Raspberry Pi Using a USB-to-TTL Serial Cable « Null Byte :: WonderHowTo

Connecting to your headless Raspberry Pi on the go typically requires a network connection or carrying around bulky peripheral hardware like a screen as well as also keyboard. With the help of an old-school connecting standard, though, you can log into your Pi coming from any computer using a simple cable. If you don’t have a power source, you can also power your Linux distro over the cable at the same time.

If you have ever used an older computer or printer, you might remember those standard RS-232 serial connectors, nevertheless there are more current as well as also commonly known interfaces like Ethernet, FireWire, as well as also USB which can connect to a machine’s console for diagnostic purposes. We’ll be using a USB-to-TTL serial cable, which is usually much smaller as well as also lighter than the serial cables of old.

While you most likely know what USB is usually, TTL means transistor-transistor logic, a digital logic solution to process as well as also interpret information. This specific serial connection is usually a legacy hardware connector which has been used for decades.

Serial communication takes place over a serial cable as well as also is usually a linear form of transferring data. which means which sends data bit-by-bit via a communication port like USB. which is usually a straightforward way to communicate, featuring both a transmitter as well as also receiver, as well as also is usually also one of the most simple ways to communicate having a device.

While you’ll have to connect to your Raspberry Pi running a Linux distro the normal way initially to enable This specific USB-to-TTL feature, subsequent logins can be done using just your USB-to-TTL serial cable.

Don’t Miss: How to Set Up a Practice Computer to Kill on a Raspberry Pi 3

The Components just for This specific Guide

If you choose to grab a serial cable coming from Adafruit or get stuck during our guide, Adafruit’s website also incorporates a not bad walkthrough on using serial cables.

currently, depending on the operating system running on your Pi as well as also the operating system running on your laptop or computer, there are a few more tasks we need to take care of first before connecting. Let’s start with the Raspberry Pi.

Step 1: Installing Prerequisites on Your Pi

Raspbian is usually the default operating system for the Raspberry Pi, as well as also Raspbian incorporates a Pi module called raspi-config which can help us easily enable the necessary setting we need. This specific module allows you to enter an almost BIOS-type configuration menu to configure different parts of the Pi’s hardware.

First, go ahead as well as also connect to your Raspberry Pi running your Linux distro the way you normally could, either via SSH or having a keyboard, monitor, as well as also mouse. Raspi-config is usually not installed on all distributions of Linux, so on Debian-based systems like Kali, you will want to open up a terminal as well as also install which by typing the following.

git clone https://github.com/snubbegbg/install_raspi-config

Next, cd to change directories by typing the following.

cd install_raspi-config

Finally, we’ll install raspi-config as well as also all the dependencies by running This specific final command.

sudo sh install.sh

currently, we’ll be able to access This specific BIOS-like menu to modify the GPIO pin settings.

Step 2: Enabling the Connection on Your Pi

When you have satisfied these requirements, boot up your Raspberry Pi with Kali again, however you normally use which, then enable the connection on which by opening a terminal as root as well as also typing:

raspi-config

currently a Raspberry Pi Software Configuration Tool will open up a fresh terminal. We can scroll down with the arrow keys as well as also select option 9 called “Advanced Options.”

Once we are inside the advanced options, scroll down using the arrow keys to “A7 Serial” as well as also press enter. which will prompt you with “could you like a login shell to be accessible over serial?” Go ahead as well as also select “Yes.” After you select which option, which will confirm “The Serial interface is usually enabled.”

The program will send you back to the main menu automatically, as well as also you can go ahead as well as also tap down as well as also select the “Finish” option. After selecting which, the program will ask you if you want to reboot. Go ahead as well as also say “Yes” to reboot your Pi as well as also apply the alterations.

Step 3: Installing Prerequisites on Your Computer

currently which our Pi has the needed software, we will need to set up some software on the computer we will be plugging the USB end of the cable into.

In This specific demonstration, we will use PuTTY, an SSH, Telnet, as well as also serial communication client which works on Windows, macOS, as well as also Linux which will allow us to make the connection. You can download as well as also install PuTTY for your operating system coming from the project’s website, nevertheless we’ll be using which here for Windows.

We’ll also be showing how to use a program called Screen if you’re running Linux. If Screen is usually not included in your distribution of Linux, you can open up a terminal window as well as also type apt-get install screen.

Don’t Miss: How to Turn Your Raspberry Pi into a Wireless Hotspot

The computer we are connecting to the Pi with will also need some USB drivers for us to properly use the serial connection cable. You can download the necessary drivers for your host operating system coming from the list below. If you’re a Linux user as well as also have recently updated your system, the driver should already be installed.

Step 4: Connecting to Your Pi’s GPIO Pins

Next, we will move to the physical aspects of This specific setup. Make sure which your Pi is usually not powered on as well as also has the Micro-SD card inserted. Break out your serial cable as well as also connect the following cables to the appropriate pins using the diagram below. If you need a more detailed view, you can check out an interactive pin diagram.

  • Connect the white cable to GPIO pin 8. The white cable will be our transmission (TXD) communication.
  • Connect the green cable to GPIO pin 10. This specific is usually our receiving (RXD) communication.
  • Connect the black cable to GPIO pin 6. This specific is usually just a ground cable to ensure which if a sudden electrical surge happens, none of the electronic components on the Pi are fried.
  • Connect the red cable to GPIO pin 4. This specific one is usually optional as well as also will provide 5 volts of power as well as also communication coming from just the serial cable itself. which’s important not to power the Pi with the Micro-USB power cable while the 5-volt pin on the GPIO is usually also powering the Pi at the same time.
A diagram of the GPIO pin design of the Raspberry Pi. Image by Tux-Man/Wikimedia Commons

Don’t Miss: How to Create a Wireless Spy Camera Using a Raspberry Pi

Remember, if you use all the USB ports on the Raspberry Pi with the 5-volt line connected, depending on what you plug into the USB ports, you may get power fluctuations on the Pi. You can see how everything is usually supposed to look inside the image below.

Don’t Miss: Turn Any Phone into a Hacking Super Weapon with the Sonic

Step 5: Starting the Connection

currently which all of which is usually finished, both our computer as well as also Raspberry Pi are ready to talk to each different! Go ahead as well as also connect your Raspberry Pi to your computer with the USB-to-TTL serial cable.

Method 1: Using Windows

If you’re using a Windows device, we want to open up “Device Manager,” then drop-down the “Ports” tab, as well as also look for what port number Windows have assigned our USB. inside the screenshot below, Windows assigned my Raspberry Pi COM3.

Next, we open up PuTTY on Windows, press the “Serial” radio button, then type in whatever COM number windows gave you. Change the Speed field to 115600. We want to change the speed because the USB platform needs more bits to be transmitted when we enable the connection.

After which is usually done, go to the bottom right as well as also press “Open” as well as also a terminal window will open asking for the username as well as also password for the Pi if the connection is usually successful. You may have to hit enter if you initially see nothing. If you haven’t changed which, the login in Kali is usually “root” as well as also “toor” as default.

Method 2: Using Linux

On your Linux device, plug in your Pi with the USB-to-TTL serial cable, as well as also after which has had time to boot, open up a terminal window. As for connecting to your Pi on Linux, which will be almost the same as on Windows, nevertheless when searching for the USB, we want to type ls /dev/ as well as also look for something similar to ttyUSBx.

Whatever number is usually at the end of the output should be the USB-to-TTL serial cable identifier for the Pi.

If you got a different number at the end of ttyUSB, make sure to swap which out inside the following command, as well as also hit return to connect to the Pi.

sudo screen /dev/ttyUSB0 115600

A fresh terminal window will pop open, again asking for your username as well as also password for the Pi. Go ahead as well as also attempt to log in.

Image by Kody/Null-Byte

Success! If which works, you should see your Pi’s message of the day (MOTD) screen to confirm you’ve logged in. Your MOTD screen may be less customized than mine.

One Cable to Rule Them All

With just an individual cable, we are currently able to both power as well as also log in to our Pi quickly as well as also conveniently coming from anywhere we want. All of This specific is usually possible without the burden of constantly carrying peripheral devices to accompany the Pi, giving you more freedom to deploy your Kali Linux environment.

If you’re not using your cable to control your Pi, This specific TTL cable is usually also great for hacking Wi-Fi routers to install DD-WRT or different custom operating systems — or almost any 3.3-volt logic serial port you want to interface with.

If you have any questions, you can leave a comment here or send a message on Twitter at @Nitroux2. as well as also make sure to stay connected as well as also check out our social media accounts!

Don’t Miss: How to Set Up Kali Linux on the fresh $10 Raspberry Pi Zero W

Cover photo as well as also screenshots by Nitrous/Null Byte

Leave a Comment

Your email address will not be published. Required fields are marked *

five × one =