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

Connecting to yourheadless Raspberry Pion the go typically requires a network connection or carrying around bulky peripheral hardware like a screen and keyboard. With the help of an old-school connecting standard, though, you can log into your Pi 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 rememberthose standard RS-232 serial connectors, but there are more current and commonly known interfaces like Ethernet, FireWire, and USB that can connect to a machine's console for diagnostic purposes. We'll be using a USB-to-TTL serial cable, which is much smaller and lighter than the serial cables of old.While you most likely know what USB is, TTL meanstransistor-transistor logic, a digital logic solution to process and interpret information. This serial connection is a legacy hardware connector that has been used for decades.Serial communication takes place over a serial cable and is a linear form of transferring data. That means it sends data bit-by-bit via a communication port like USB. It is a straightforward way to communicate, featuring both a transmitter and receiver, and is also one of the most simple ways to communicate with a device.While you'll have to connect to your Raspberry Pi running a Linux distro the normal way initially to enable this 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 3The Components for This GuideARaspberry Pi 3, although the Pi 2 and original Pi should also work. You can do this to the Pi Zero and Pi Zero W as well, although you'll need to pick up somemale header pinsto solder onto the Pi Zero boards.AMicro-SD cardwith a Linux distro on it (likeour Kali Linux Raspberry Pi build).AUSB-to-TTL serial cableto connect your Kali Pi to.Finally, alaptopor computer with an open USB port to communicate with the Pi through the cable.If you choose tograb a serial cable from Adafruitor get stuck during our guide, Adafruit's website also has a goodwalkthrough on using serial cables.Now, depending on the operating system running on your Pi and 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 PiRaspbian is the default operating system for the Raspberry Pi, and Raspbian has a Pi module calledraspi-configwhich can help us easily enable the necessary setting we need. This module allows you to enter an almost BIOS-type configuration menu to configure different parts of the Pi's hardware.Don't Miss:Boot Multiple Operating Systems on the Raspberry Pi with BerryBootFirst, go ahead and connect to your Raspberry Pi running your Linux distro the way you normally would, either via SSH or with a keyboard, monitor, and mouse. Raspi-config is not installed on all distributions of Linux, so on Debian-based systems like Kali, you will want to open up a terminal and install it by typing the following.git clonehttps://github.com/snubbegbg/install_raspi-configNext,cdto change directories by typing the following.cd install_raspi-configFinally, we'll install raspi-config and all the dependencies by running this final command.sudo sh install.shNow, we'll be able to access this BIOS-like menu to modify the GPIO pin settings.Step 2: Enabling the Connection on Your PiWhen you have satisfied these requirements, boot up your Raspberry Pi with Kali again, however you normally use it, then enable the connection on it byopening a terminal as rootand typing:raspi-configNow aRaspberry Pi Software Configuration Toolwill open up a new terminal. We can scroll down with the arrow keys and select option 9 called "Advanced Options."Once we are in the advanced options, scroll down using the arrow keys to "A7 Serial" and pressenter. It will prompt you with "Would you like a login shell to be accessible over serial?" Go ahead and select "Yes." After you select that option, it will confirm "The Serial interface is enabled."The program will send you back to the main menu automatically, and you can go ahead and tap down and select the "Finish" option. After selecting it, the program will ask you if you want to reboot. Go ahead and say "Yes" to reboot your Pi and apply the changes.Step 3: Installing Prerequisites on Your ComputerNow that 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 demonstration, we will use PuTTY, an SSH, Telnet, and serial communication client that works on Windows, macOS, and Linux that will allow us to make the connection. You candownload and install PuTTYfor your operating system from the project's website, but we'll be using it here for Windows.We'll also be showing how to use a program calledScreenif you're running Linux. If Screen is not included in your distribution of Linux, you can open up a terminal window and typeapt-get install screen.Don't Miss:How to Turn Your Raspberry Pi into a Wireless HotspotThe 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 from the list below. If you're a Linux user and have recently updated your system, the driver should already be installed.USB drivers for WindowsUSB drivers for macOSStep 4: Connecting to Your Pi's GPIO PinsNext, we will move to the physical aspects of this setup. Make sure that your Pi is not powered on and has the Micro-SD card inserted. Break out your serial cable and connect the following cables to the appropriate pins using the diagram below. If you need a more detailed view, you cancheck 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 is our receiving (RXD) communication.Connect the black cable to GPIO pin 6.This is just a ground cable to ensure that 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 one is optional and will provide 5 volts of power and communication from just the serial cable itself. It's important not to power the Pi with the Micro-USB power cable while the 5-volt pin on the GPIO is also powering the Pi at the same time.A diagram of the GPIO pin layout of the Raspberry Pi.Image by Tux-Man/Wikimedia CommonsDon't Miss:How to Create a Wireless Spy Camera Using a Raspberry PiRemember, 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 supposed to look in the image below.Don't Miss:Turn Any Phone into a Hacking Super Weapon with the SonicStep 5: Starting the ConnectionNow that all of that is finished, both our computer and Raspberry Pi are ready to talk to each other! Go ahead and connect your Raspberry Pi to your computer with the USB-to-TTL serial cable.Method 1: Using WindowsIf you're using a Windows device, we want to open up "Device Manager," then drop-down the "Ports" tab, and look for what port number Windows have assigned our USB. In the screenshot below, Windows assigned my Raspberry Pi COM3.Don't Miss:Use a Raspberry Pi as a Dead Drop for Anonymous Offline CommunicationNext, we open up PuTTY on Windows, press the "Serial" radio button, then type in whatever COM number windows gave you. Change theSpeedfield to115600. We want to change the speed because the USB platform needs more bits to be transmitted when we enable the connection.After that is done, go to the bottom right and press "Open" and a terminal window will open asking for the username and password for the Pi if the connection is successful. You may have to hitenterif you initially see nothing. If you haven't changed it, the login in Kali is "root" and "toor" as default.Method 2: Using LinuxOn your Linux device, plug in your Pi with the USB-to-TTL serial cable, and after it has had time to boot, open up a terminal window. As for connecting to your Pi on Linux, it will be almost the same as on Windows, but when searching for the USB, we want to typels /dev/and look for something similar tottyUSBx.Whatever number is 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 that out in the following command, and hitreturnto connect to the Pi.sudo screen /dev/ttyUSB0 115600A new terminal window will pop open, again asking for your username and password for the Pi. Go ahead and attempt to log in.Image by Kody/Null-ByteSuccess! If it 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.Don't Miss:Set Up a Headless Raspberry Pi Hacking Platform Running Kali LinuxOne Cable to Rule Them AllWith just a single cable, we are now able to both power and log in to our Pi quickly and conveniently from anywhere we want. All of this is 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 TTL cable is also great for hacking Wi-Fi routers to install DD-WRT or other 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. And make sure to stay connected and check out our social media accounts!Don't Miss:How to Set Up Kali Linux on the New $10 Raspberry Pi Zero WFollow Null Byte onTwitter,Flipboard, andYouTubeFollow WonderHowTo onFacebook,Twitter,Pinterest, andFlipboardWant to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseCover photo and screenshots by Nitrous/Null ByteRelatedHow To:Load Kali Linux on the Raspberry Pi 4 for the Ultimate Miniature Hacking StationHow To:Set Up Kali Linux on the New $10 Raspberry Pi Zero WHow To:Build a Beginner Hacking Kit with the Raspberry Pi 3 Model B+How To:Boot Multiple Operating Systems on the Raspberry Pi with BerryBootHow To:Build an Off-Grid Wi-Fi Voice Communication System with Android & Raspberry PiRaspberry Pi Alternatives:10 Single-Board Computers Worthy of Hacking Projects Big & SmallHow To:Discover & Attack Raspberry Pis Using Default Credentials with Rpi-hunterHow To:Automate Hacking on the Raspberry Pi with the USB Rubber DuckyHow To:Set Up a Headless Raspberry Pi Hacking Platform Running Kali LinuxHow To:Enable Monitor Mode & Packet Injection on the Raspberry PiHow To:Wardrive with the Kali Raspberry Pi to Map Wi-Fi DevicesHow To:Lock Down Your DNS with a Pi-Hole to Avoid Trackers, Phishing Sites & MoreHow To:Set Up Network Implants with a Cheap SBC (Single-Board Computer)How To:Build a Portable Pen-Testing Pi BoxThe Hacks of Mr. Robot:How to Build a Hacking Raspberry PiHow To:Build a Pumpkin Pi — The Rogue AP & MITM Framework That Fits in Your PocketHow To:Modify the USB Rubber Ducky with Custom FirmwareOpen Sesame:Make Siri Open Your Garage Door via Raspberry PiBuyer's Guide:Top 20 Hacker Holiday Gifts for Christmas 2017News:Smart Home Proof of Concept Uses a Raspberry Pi to Control Air Conditioner with HoloLensRaspberry Pi:Hacking PlatformHow To:Detect Bluetooth Low Energy Devices in Realtime with Blue HydraHow To:Share Wi-Fi Adapters Across a Network with Airserv-NgHow To:Turn Any Phone into a Hacking Super Weapon with the SonicHow To:Create a Wireless Spy Camera Using a Raspberry PiNews:This Guy Built an Impressive Smart Mirror Controlled by Gestures & Voice