Skip to content

Instantly share code, notes, and snippets.

@jarun
Last active September 24, 2024 08:22
Show Gist options
  • Save jarun/660fd1d5e79e1a4038de8ba5f2e1a513 to your computer and use it in GitHub Desktop.
Save jarun/660fd1d5e79e1a4038de8ba5f2e1a513 to your computer and use it in GitHub Desktop.
How to connect to Termux from Ubuntu desktop

In this example, we will setup a SSH server on Termux (for Android) and connect to the server from Ubuntu desktop. However, a similar procedure should work with any SSH server.

  1. Generate your ssh key pair on your desktop

    $ ssh-keygen
    
  2. Check your desktop IP address (say, 192.168.0.100)

  3. Run ssh server on your desktop

  4. Copy the file to Termux over SCP

    $ scp arun@192.168.0.100:~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
    

    You can stop ssh server on your desktop now

  5. Install ssh server on Termux

    $ pkg in openssh
    
  6. Run ssh server on Termux (IP address 192.168.0.102)

    $ sshd
    
  7. Find out your username on Termux

    $ whoami
    u0_z007
    
  8. Connect from your desktop

    $ ssh u0_z007@192.168.0.102 -p 8022
    Welcome to Termux!
    
Copy link

ghost commented Jun 14, 2022

I used it on window 10 with git bash and it worked thank you brother.

@DanielProgrammer64
Copy link

Ayo, it does not worked to me

@Kelvin8361
Copy link

Root

@deanrobin333
Copy link

Just brilliant. I was wondering why it was refusing to work, as I can use SSH with my devices.
It's because Termux doesn't use the default SSH port 22.
Port 8022 did the trick. So now I just set up my ssh config file to use port 8022 for Termux.
Much appreciated for this.

@md-shah
Copy link

md-shah commented Aug 30, 2024

Thank you!

@Tom5521
Copy link

Tom5521 commented Sep 20, 2024

Just brilliant. I was wondering why it was refusing to work, as I can use SSH with my devices. It's because Termux doesn't use the default SSH port 22. Port 8022 did the trick. So now I just set up my ssh config file to use port 8022 for Termux. Much appreciated for this.

Same, I was losing the hope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment