How to connect android phone to PC using SSH & putty

How to connect android phone to PC using SSH & putty

The goal of this topic is, How to connect android phone to PC using SSH & putty without having to rely on any USB driver or mobile manufacturer PC suit software. By using SSH facility, you can access terminal or shell of Android Linux kernel. As most of you know that Android is a full fledged operating system derived from Linux kernel one can use it as a full blown operating and execute all kinds of OS commands.

NOTE :- I am not going into depth of SSH Server-Client and all that networking stuff as my goal here is to access shell or terminal of android phone through windows PC.

This approach is very quick and may take less than 5 minute to access your android shell using your PC, so without wasting further lines here is the steps;

You will need

  1. Your Android phone ( Rooted and with Wi-Fi functionality )
  2. SSHDroid (SSH server)
  3. PuTTY.exe (SSH client)

Setup SSHDroid

How to connect android phone to PC using SSH & putty

    • Install “SSHDroid” from android market to your phone this will turn your phone into a SSH server

 

    • For the first time you need to set-up a password to log-in shell. Default password is admin which may you have to change on first time

 

Setup Putty

How to connect android phone to PC using SSH & putty

    • Download PuTTY.exe for SSH Client on your windows PC, it comes in single executable file so you don’t need to install that just double click on that and PuTTY will start.

 

    • There is no need to setting up any thing in PuTTY.

 

Let’s start

  1. First step is to running Wi-Fi and connect your android phone to target PC, then run SSHDroid server into your mobile phone, but before that make sure under the SSHDroid’s application window click Options -> “Require WiFi” is checked as seen on above pic screen 2. And then click “start” option.
  2. Once SSH server is successfully started it will show IP address of your mobile phone in light sky color like this root@192.168.43.129 as seen on screen 4.
  3. Take the IP “192.168.43.129” and type it to your PuTTY program’s (PC) host field and hit connect. Make sure port number is 22 as seen in second pic.
  4. It will ask for certification click ok and then command line log-in window will appear, type “root” hit enter and then type the password for root user, default is “admin” as i mentioned before. After successful log-in you will be able to use Linux commands like ls, reboot -f, mkdir, find, etc.

if your phone is connected to internet you can also use network commands like ping, wget, telnet etc.

Alternate Software

Alternates in place of SSHDroid

QuickSSHd, MobileSSH, ConnectBot, SyncMe Wireless and many more.

Alternates in place of PuTTY

MobaXterm, KiTTY, Bitvise SSH Client, Xshell 4 and many more.

Where to go from here

There are many applications besides SSHDroid and Putty for Server and Client implementation respectively. But the most exciting thing is that, there are many tools like PuTTY and SSHDroid to do a lot fun with your android gadget like

  • Access Linux shell remotely : PuTTY
  • File Transfer remotely : WinSCP
  • Access Linux graphics on windows : Xming
  • Customize your gadget by editing source code of your phone(Must be professional programmer for this)
  • And my favorite one is to hack mobile phones by writing shell scripts and small C/C++ program for fun.

Suggested Reading

  1. Vim CrashCourse
  2. How to write first makefile for c source code in linux – Tutorial