LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 04-13-2020, 07:18 AM   #1
zpimp
Member
 
Registered: Oct 2014
Posts: 73

Rep: Reputation: Disabled
android - linux over ssh for beginners


i like open source open standards, cause they dont change
i only run linux on computers and android on phone
so the logical option would be ssh,rsync,sshfs
they get better, they dont change, they never die
im using this in home network, dont leave stuff open on other networks

you probably know what ssh and rsync are
sshfs is a remote filesystem built ontop sftp (wich runs over ssh)
sshfs is something like nfs(unix), smb(windows), afp(apple)
sshfs is almost the same speed as all the above if optimized
the difference is sshfs is easier to setup since it runs on ssh
you only have to start the ssh service/server, and youre set (server side)

on linux-linux its pretty simple, start the service, find server ip, on the client run the command to mount or rsync

setup android ssh server
but since android is not linux its not that simple
first we need a terminal, so we install termux from playstore
run
pkg install openssh - to install ssh client/server
termux-setup-storage - to make some of our storage available to termux/ssh
passwd - to enter and confirm password (since well use this to auth)
sshd - to start the ssh server on your android device
after yo try all this remember to kill the sshd process
killall sshd

now on your linux computer connect to the android server
ssh 192.168.0.101 -p 8022
that is the ip of my android phone, and 8022 is the port which ssh runs on termux instead of default port 22
if you get key verification failed, its probably cause of dhcp, on computer you have to
rm /home/user/.ssh/known_hosts, only do this if you know it wont f*ck your shit up

now we can mount the phone storage
mkdir /home/user/phone
sshfs -p 8022 192.168.0.101:/storage/emulated/0 /home/user/phone
after youre done, close apps accessing the phone and
umount /home/user/phone

you can ofcource rsync locally (after mount), or rsync over ssh
time rsync -av --info=progress2 -e "ssh -p 8022" 192.168.0.101:/storage/emulated/0/Download/ /home/user/phone-backup/
as you can see we dont need username on android ssh server

now the interesting part
accessing sshfs target from android client
since android is not linux we cant mount sshfs like on linux but it is accessible
and i searched for apps on playstore to do this
i found
file manager +
fx file manager
mixplorer (not on google play)
solid explorer
smart file manager
x-plore

search for the option network/sftp
i like totalcmd very much on windows and android but its sftp plugin doesent actually mount sshfs, its just sftp (it has to download file first)

from all of the above
fx file manage
solid explorer
file manager +
seem to be able to access android sftp/sshfs (at username you put whatever you want)
the others seem to want the termux username, and some dont work even with that

too bad we cant mount sshfs directly in termux, but until then you should know there is at least a gui/closed source way
you can use this to watch movies from your linux box, on your phone cause you can skip forward, or whatever
after yo try all this remember to kill the sshd process on android
killall sshd
hope this was helpful

Last edited by zpimp; 04-13-2020 at 07:30 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh over wifi failed (connection reset) but ssh over the wire is ok aclarck Linux - Software 3 03-01-2020 03:57 AM
LXer: Patents Are Turning BlackBerry and Nokia, Which Used Android, Into Anti-Android Fronts That Tax Android OEMs LXer Syndicated Linux News 0 10-14-2017 09:05 AM
LXer: Android Programming for Beginners: Part 2 LXer Syndicated Linux News 0 01-02-2013 04:42 PM
LXer: Android Programming for Beginners: part 1 LXer Syndicated Linux News 0 12-20-2012 01:40 PM
compile kernel over, and over, and over....... chopp Slackware 10 03-30-2004 05:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration