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.
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.
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.
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 ./