Connecting a smartphone to Android to a computer with Linux often causes difficulties for users, especially if previously the interaction experience was limited Windows or macOS. Unlike proprietary systems where drivers are installed automatically, on Linux the process may require manual configuration. However, after the correct configuration, you will get not only access to files, but also debugging capabilities via ADB, device control via Wi-Fi and even using your smartphone as a webcam or modem.

In this article we will analyze all the current connection methods - from basic MTPconnection to advanced methods like scrcpy for screen mirroring. Particular emphasis is placed on solving typical problems: when the device is not detected, files are not copied, or access errors occur. All instructions have been tested on distributions Ubuntu 24.04, Fedora 40 and Arch Linux with the kernel 6.5+.

If you are using a rare distribution or a custom kernel, some commands may require adaptation. In this case, refer to your distribution's documentation or check for package availability via pacman -Ss, apt search or dnf list.

๐Ÿ“Š Which Linux distribution are you using?
Ubuntu/Debian
Arch/Manjaro
Fedora/RHEL
OpenSUSE
Other

1. Preparing an Android device for connection

Before physically connecting the smartphone to the computer, you need to configure several settings on the Androiddevice itself. Without this, even a properly configured Linux will not be able to recognize the gadget.

First of all, activate developer mode:

  1. Go to Settings โ†’ About phone.
  2. Find item Build number and tap on it 7 times in a row. A notification โ€œYou have become a developerโ€ will appear.
  3. Return to the main settings menu - a new section will appear there For developers.

Now in the section For developers enable:

  • ๐Ÿ”Œ USB debugging (required for ADB and scrcpy)
  • ๐Ÿ“ฑ OEM unlocking (required for firmware or root access)
  • ๐Ÿ”„ Do not disable data transfer (prevents automatic transition to charging mode)

For devices with Android 11+ you may also need explicit permission to transfer files when you first connect. If, after connecting to a PC, the โ€œAllow access to data?โ€ request appears on the smartphone screen, be sure to confirm. it.

๐Ÿ’ก

On some devices (for example, Xiaomi or Realme) USB debugging is automatically disabled after a reboot. Check its status before each connection.

2. Connection via MTP (Media Transfer Protocol)

MTP is a standard protocol for transferring files between Android and a computer. In Linux, its support is implemented through packages mtp-tools and gvfs-mtp (or mtpfs for older systems).

Install the necessary packages depending on the distribution:

# Debian/Ubuntu

sudo apt install mtp-tools gvfs-mtp libmtp-common

Arch/Manjaro

sudo pacman -S mtpfs gvfs-mtp

Fedora/RHEL

sudo dnf install mtp-tools gvfs-mtp

After installation, connect your smartphone with a cable USB-C (or Micro-USB for older models) and select mode File transfer (MTP)on the device. In most file managers (for example Nautilus, Dolphin, Thunar), the device will appear in the side menu as a removable drive.

If the device does not appear:

  1. Check that the cable supports data transfer (some cheap cables are only designed for charging).
  2. Restart the service gvfs:
    killall gvfs-mtp-volume-monitor
    

    gvfs-mtp-volume-monitor &

  3. Make sure that the lsusb device is detected (there should be a line with Google, Samsung or another manufacturer).

Has the cable been tested for functionality?

Are the mtp-tools and gvfs-mtp packages installed?

Is the device visible in the output of the lsusb command?

Is the gvfs service restarted?

-->

3. Connection via ADB (Android Debug Bridge)

ADB is a bridge for debugging and managing an Android device from a computer. It allows you to install applications, execute shell commands, and even screen mirroring. To work you will need:

  1. Install adb on Linux:
    # Debian/Ubuntu
    

    sudo apt install adb fastboot

    Arch/Manjaro

    sudo pacman -S android-tools

    Fedora/RHEL

    sudo dnf install android-tools

  2. Connect the device with a cable and select the mode File transfer (not Charging!).
  3. In the terminal, do:
    adb devices

    A request for debugging permission will appear on the smartphone screen - confirm it.

If adb devices returns an empty list:

  • ๐Ÿ”Œ Check that USB debugging is enabled in the developer options.
  • ๐Ÿ”„ Switch the USB mode on the device (for example, from MTP to PTP and back).
  • ๐Ÿง Make sure that the user is part of the group plugdev:
    sudo usermod -aG plugdev $USER
  • ๐Ÿ”ง Some devices (for example, OnePlus or Xiaomi) require udev vendor rules. Download them from the manufacturer's official website or from the repository android-udev-rules.

After successful connection, you can use commands like:

adb install app.apk # Install APK

adb shell ls /sdcard # View files

adb logcat # View system logs

How to check if Linux sees your device via USB?

Run the command lsusb in the terminal. If the device is connected, you will see a line like:

Bus 001 Device 003: ID 2207:0011, where 2207 is the vendor ID (for example, Samsung has ID 04e8, Google โ€” 18d1). If the device is not listed, the problem is with the cable, USB port, or power.

4. Wireless connection via Wi-Fi

If you are tired of fiddling with cables, you can connect Android to Linux via Wi-Fi. To do this, you first need to establish a connection via USB, and then switch to wireless mode.

Instructions:

  1. Connect the device via USB and make sure that adb devices sees it.
  2. Find out the local IP address of the smartphone:
    adb shell ip route

    In the output, find a line like 192.168.x.x.

  3. Connect via Wi-Fi:
    adb tcpip 5555
    

    adb connect 192.168.x.x:5555

  4. Disconnect the USB cable. Now the device will be accessible via Wi-Fi.

To return to USB mode, do:

adb usb

Wireless connection limitations:

  • ๐Ÿ“ถ File transfer speed is lower than USB 3.0 (about 10-15 MB/s versus 40-60 MB/s).
  • ๐Ÿ”‹ Consumes more energy (active Wi-Fi drains the battery faster).
  • ๐Ÿ”’ Works only in one subnet (the router must be common to the PC and smartphone).
๐Ÿ’ก

Wireless connection via ADB is ideal for debugging applications or managing a device without physical access to it. However, to transfer large files (for example, backups), it is better to use USB.

5. Using scrcpy to mirror screen

scrcpy is an open source utility that allows you to mirror the Android screen on a Linux computer in real time and control it with your keyboard/mouse. Features:

  • ๐Ÿ–ฅ๏ธ Support for high FPS (up to 60 frames/s).
  • ๐ŸŽฎ Possibility of audio transmission (required Android 10+).
  • ๐Ÿ”Œ Works both via USB and Wi-Fi.

Installation on popular distributions:

# Debian/Ubuntu

sudo apt install scrcpy

Arch/Manjaro

sudo pacman -S scrcpy

Fedora/RHEL

sudo dnf install scrcpy

Basic launch:

scrcpy

Useful options:

Command Description
scrcpy --bit-rate 8M Increases bitrate for better picture quality (useful for video).
scrcpy --max-size 1024 Limits the window size to 1024px on the larger side.
scrcpy --record file.mp4 Records the screen to a file file.mp4.
scrcpy --turn-screen-off Turns off the smartphone screen during broadcast (saves battery).

Set to transmit audio scrcpy with support audio (requires assembly from source) and use the option --audio. On Android 10 and newer, sound is transmitted via ADB without root access.

scrcpy -s 192.168.x.x:5555 (for Wi-Fi) or scrcpy -s device_from_adb_devices (for USB).-->

6. Solving common problems

Even with proper configuration, errors may occur. Here are the most common ones and ways to fix them:

Problem 1: The device is connected, but is not detected in lsusb.

  • ๐Ÿ”Œ Try a different USB port (preferably USB 3.0 blue).
  • ๐Ÿ”„ Restart your computer and smartphone.
  • ๐Ÿ› ๏ธ Check if the cable is broken (try charging another device with it).

Problem 2: MTP connects, but files are not copied.

  • ๐Ÿ“ Make sure there is enough places.
  • ๐Ÿ”’ Check folder permissions (for example, /sdcard/DCIM may be protected).
  • ๐Ÿง Reinstall packages mtp-tools and gvfs-mtp.

Problem 3: ADB gives an error no permissions.

  • ๐Ÿ” Add the user to the group plugdev and reboot.
  • ๐Ÿ“„ Create a rules file for udev (example for Samsung):
    echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"' | sudo tee /etc/udev/rules.d/51-android.rules
    

    sudo udevadm control --reload-rules

    sudo udevadm trigger

Problem 4: scrcpy works with lags.

  • ๐Ÿ“‰ Reduce the bitrate: scrcpy --bit-rate 2M.
  • ๐Ÿ–ฅ๏ธ Close other resource-intensive applications on your PC.
  • ๐Ÿ”Œ Connect via USB instead Wi-Fi.
How to find the vendor ID of your device?

Connect your smartphone and execute lsusb. In the output, find the line with your device, for example:

Bus 001 Device 003: ID 2207:0011

The first 4 characters (2207) - this is the vendor ID. It must be used in udev rules.

7. Alternative connection methods

If standard methods do not work or you need specific functions, consider these options:

1. FTP server on Android

Applications like Solid Explorer or FX File Explorer allow you to launch an FTP server directly on your smartphone. After that, you can connect to it from Linux via any FTP client (for example, lftp or FileZilla).

lftp ftp://192.168.x.x:2221

2. SSH server (requires root)

Using Termux or SSH Server you can run an SSH server on Android and connect to it via ssh:

ssh user@192.168.x.x -p 2222

This gives full control over the file system, but requires superuser rights.

3. KDE Connect

The application KDE Connect allows you not only to transfer files, but also:

  • ๐Ÿ“ฑ Control the media player on your PC from your smartphone.
  • ๐Ÿ“ Copy text between devices.
  • ๐Ÿ–ฑ๏ธ Use your smartphone as a touchpad or remote control.

Install kdeconnect on Linux and the application KDE Connect from Google Play.

4. USB tetring (Internet sharing)

If you need to distribute the Internet from your phone to a PC:

  1. Enable USB tetring in the Android settings (Settings โ†’ Network and Internet โ†’ Access point and modem).
  2. On Linux, check that a new network interface has appeared (usually usb0).
  3. Configure routing (if it does not work automatically):
    sudo dhclient usb0
๐Ÿ’ก

KDE Connect is the most universal solution for integrating Android and Linux. It does not require root access, works over Wi-Fi and supports most of the features "from boxes."

8. Safety when connecting Android to Linux

When working with ADB and other tools, it is important to take precautions so as not to put the device at risk:

1. Disable USB debugging in public places

If you connect your smartphone to other people's computers (for example, in a cafe or copy center), always disable USB debugging. Otherwise, an attacker can gain full control of the device via ADB.

2. Use strong passwords for Wi-Fi. data-i="237">When connected wirelessly via

When connected wirelessly via ADB or scrcpy make sure your network is password protected WPA3. Otherwise, someone from the same network may connect to your device.

3. Check udev rules

If you manually added rules for udev (for example, for ADB), make sure that they do not give excessive rights. The optimal rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", MODE="0660", GROUP="plugdev"

where XXXX is the vendor ID of your device.

4. Encrypt backups

If you create backups via ADB (adb backup, use the flag -f to save to an encrypted file:

adb backup -f backup.ab -apk -shared -all -nosystem

Without encryption, the backup may contain sensitive data (for example, passwords from Wi-Fi).

adb shell su -c "rm /data/misc/wifi/WifiConfigStore.xml"

But this requires root access!-->

โš ๏ธ Attention: On devices with Android 11+ Google has tightened the security policy for ADB. Now, to access some sections (for example, /data/data), even with root access, explicit permission is required via adb root, which is reset after a reboot.

FAQ: Frequently asked questions

My smartphone is not detected in Linux, although everything works in Windows. What's the problem?

Most likely, Linux does not have rules udev for your device. Install the package android-udev-rules (available in the AUR for Arch or via apt on Ubuntu) or add the rule manually as described in the pro section ADB.

Also check that the kernel supports your USB controller. Some laptops (e.g. chipset Intel 12th generation) may require a 12th generation Intel core 5.15+.

Can I connect Android to Linux via Bluetooth?

Technically yes, but the functionality will be extremely limited. Via Bluetooth, you can only transfer individual files (for example, photos) at a low speed (~1 MB/s). To do this:

  1. Turn on Bluetooth on both devices.
  2. Pair them (on Linux use blueman or bluetoothctl).
  3. Send files via the "Send" menu on Android or obexftp on Linux.

Bluetooth is not suitable for full operation (ADB, MTP).

How to connect Android as a webcam to Linux?

Use the application DroidCam (available in Google Play). Linux:

  1. Install the client droidcam from official website.
  2. Connect your smartphone via USB or Wi-Fi (select the appropriate mode in the application settings).
  3. In the app on your PC, specify the IP address or select USB device.
  4. In apps like OBS or Zoom select DroidCam Source as the video source.

For better quality, use a USB connection and disable video compression in the application settings.

Why doesn't scrcpy transmit sound on my device?

Transferring audio to scrcpy works only on Android 10+ and requires:

  • Assemblies scrcpy s support audio (install from sources with the flag --enable-audio).
  • Lack of root access (on some firmware the sound is not transmitted with root).
  • Start with option --audio:
    scrcpy --audio

On Android 9 and older, sound is not transmitted without system modifications.

Is it possible to connect Android to Linux via USB-C to USB-C (without adapters)?

Yes, if your computer supports USB OTG in host mode (which is typical for most modern laptops). You will need a cable USB-C โ€” USB-C with support for data transfer (not all charging cables are suitable!).

When connecting:

  1. On your smartphone you may be asked to select a mode - select File transfer.
  2. On some devices (for example, Google Pixel) you will need explicit permission to USB OTG in the settings.
  3. If the connection does not work, try using an adapter USB-C โ€” USB-A.

Now you know all the current connection methods Android to Linux โ€”from basic file transfer to advanced scenarios like screen mirroring or remote debugging. If none of the methods worked, check the compatibility of your device with the distribution you are using: some rare models (especially from little-known brands) may require additional drivers or kernel patches. In such cases, contact your distribution's community or forums like XDA Developers.

To automate routine tasks (for example, backups or file synchronization), consider writing scripts on Bash or Python using ADB and rsync. This will save time and reduce the risk of errors during manual operations.