You will need
Your Android Phone (Rooted and with Wi-Fi)
SSHDroid (SSH server)
PuTTY.exe (SSH client)
Configure SSHDroid
Install "SSHDroid" from the Android market on your phone, this will turn your phone into an SSH server.
For the first time you need to configure a password to enter the shell. The default password is the administrator, which you can change for the first time.
Putty setup
Download PuTTY.exe for SSH Client on your Windows PC, it comes in one executable file, so you do not need to install it, just double-click on it and PuTTY will start.
There is no need to configure anything in PuTTY.
Lets run
The first step is to launch Wi-Fi and connect your Android phone to the target PC, and then launch the SSHDroid server on your mobile phone, but before that, make sure that in the SSHDroids application window click "Settings" → "Require WiFi", see above fig. screen 2. And then click the "Start" button.
Once the SSH server has been successfully launched, it will display the IP address of your mobile phone in the color of the sky, like this root@192.168.43.129, as shown on screen 4.
Take the IP “192.168.43.129” and enter it in the PuTTY host field (PC) and click “Connect”. Make sure the port number is 22, as shown in the second figure.
It will ask the certificate to click ok, and then the command prompt window will appear, enter "root" hit enter and enter the password for the root user, the default is "admin", as I mentioned earlier. After a successful login, you will be able to use Linux commands such as ls, reboot -f, mkdir, find, etc.
If your phone is connected to the Internet, you can also use network commands such as ping, wget, telnet, etc.
Source: - How to connect an Android phone to a PC using SSH and putty