Connect the android and samsung mobile to pc without any usb cable.

We use ssh to connect the android or samsung mobile to the pc, first install the SSHelper in the mobile from the google store , open the SSHelper, this show the ip address, ports and the password for ssh connection to the mobile, the default password is admin change the password for security.

Connect in linux:

Install these packages:
sudo apt install ssh sshpass
Open the SSHelper in mobile that will give the ip address and ports to use to connect with ssh from the pc now run the ssh command in linux terminal:
ssh -p 2222 root@mob_ip_address
The user for mobile ssh is root and default password is admin.
This is a bash script that use the command arp that prints the local network ip addresses with there mac address the, the grep command grep the given mad address and the auk command prints the ip address of the mac and th ip variable keep the ip to pass to the ssh command, sshpass pass your password to the ssh and -o option don't use the ssh keys:
ip="$(arp -n | grep 7c:1c:68:3b:3d:fb | awk '{print $1}')"
sshpass -p "my_pass" ssh -p 2222 -o StrictHostKeyChecking=no root@$ip
Replace the above mac address for your one.
To know the mobile sdcard correct path open the sdcard in the linux terminal with the ssh above command.
Use the scp and rsync to copy or sync the data, to sync the mobile folder (destination) with local pc folder (source), open the mobile sdcard folder in the linux terminal and then run the command:
rsync -r -v -e ssh [email protected]:/path_to/pc_local/folder/ ./
In above command the 192.168.1.103 is the pc ip address and then path to the pc folder, this is other command doing the same thing without to open the mobile sdcard folder:
rsync -r -v -e "ssh -p2222" /path_to/local_pc/folder/ [email protected]:/data/data/com.arachnoid.sshelper/home/SDCard/mobile_folder/
To sync the local pc (destination) folder with the mobile folder (source), open the pc local folder and run the command:
rsync -r -v -e "ssh -p2222" [email protected]:/data/data/com.arachnoid.sshelper/home/SDCard/mob_folder/ ./
To transfer file from pc to the mobile open the local pc folder containing the file and then run the command:
scp -P 2222 test [email protected]:/data/data/com.arachnoid.sshelper/home/SDCard/
In the above command the -P is capital for the SSHelper port number, to copy the file from mobile to the local pc:
scp -P 2222 [email protected]:/data/data/com.arachnoid.sshelper/home/SDCard/test ./

Connect in Windows 10:

Downlaod and install the WinSCP from https://winscp.net/eng/index.php and the kitty from http://www.9bis.net/kitty/.
These two are gui ssh clients enter the ip and password and port from the SSHelper to these clients.


<< Previous Next >>