Homestead Tinkerer
Would you like to react to this message? Create an account in a few clicks or log in to continue.

File sharing between linux and android

Go down

File sharing between linux and android Empty File sharing between linux and android

Post by Admin Sun Apr 24, 2022 10:11 pm

Used to be you plugged phone into computer via usb and it immediately saw it like an extra thumb drive.  But of course nobody likes easy peasy.  So they added bunch permissions and "security".  

I wanted to move some photos from cell to MX19.  Swear I did it before, but couldnt.  I could see the pics on the phone but couldnt touch them, couldnt even do a screen shot.  gMTP built into MX could see them, couldnt download even run via sudo.  

Opened VoidPup, and yea it didnt auto mount phone, but does have PupMTP app.  It could access and download the photos.  Fine but writing on the wall.

Well since I have adb installed, yes can use it.  First bring up the  "adb shell", this is different than linux terminal.  Then navigate using ls and cd to find location of file or directory you want.  Then "sudo adb pull /path"  Substituting actual path to file on phone.  This works and if you only have a few or occasional photos, works fine.  Could even automate it to pull the DCIM directory with one click, if pics all you want to transfer.  Can also push files onto phone.

But if you want to regularly move files back and forth.  Well in linux samba share is obvious one.  Not simple to set up for somebody new to it.  Looked and one can also use FTP server and client, but you need a wifi network.  

I dont have wifi connection but sure I can set up an adhock one using create_ap.  I used it in past to set up a hotspot to share an internet connection via wifi.  But his time just want a local network without internet.  Yes it can do that too.  https://askubuntu.com/questions/970445/how-to-create-hotspot-without-internet-connection



   Now start hotspot from your linux without internet:

   sudo create_ap -n wlp2s0 MyAccessPoint

   You can then connect clients. Your internet would not be shared but you can do samba and other things without internet

And it works.  I for whatever reason had create_ap installed on MX.  And yes its simple and it works.

Now connecting phone to this hotspot.  Yes but it immediately drops saying no internet access detected.  Bit searching and yea Android by default disconnects immediately when connected to a wifi network without internet.  But more searching and yes you can change that setting.  Bring up the adb shell and

settings put global captive_portal_detection_enabled 0

Now stays connected.  The article I found describing easiest way to use FTP file sharing suggested ES File Explorer on phone and Filezilla on computer.  There is linux version Filezilla.  

I will say though its a powerful and free app, not that impressed with ES.  Navigating the app without triggering ads for upgrade or demands I create an online account, seems unnecessarily difficult.  No you dont have to do any of that.  Under the icons, little arrow, click that and more icons including one for Networking.  Open that let it find the wifi network, then click FTP, it will pop up screen with IP number and port number.  Hit connect or whatever.  

NOw on Filezilla on computer, forget the networking wizard.  MANUALLY insert IP number from ES and the port number.  Connect.  Bingo you get two pane file manager much like the old Midnight Commander.  Anyway at that point its trivial to move files around.

Just saying this works, its not too hard though everything is easy enough with bit practice.  That first time that is PITA.

Anyway next adventure is maybe figuring out how to use samba share on this adhoc wifi network.  Samba is included  or easily available for any linux.  Configuring it less than obvious.  Its designed to do lot things.    So making it do what you want it to do is the trick.  There is a small free app (without the nags or ads) for Android side of things.  Will describe that next post in this thread.  But honestly even if gMTP or kdeMTP or PupMTP get deprecated, adb and the FTP setup I described do work fine.  I know lot people just email photos or upload them to cloud.  Meh, why when you can do it local.  I still dont see need to be so protective, seriously somebody wants to steal pics of my garden, more power to them.  I liked old way where phone was pretty much just seen as another storage thumb drive.  They are overthinking this.  If somebody is worried about theft, then encrypt the pics or the drive or whatever.

Admin
Admin

Posts : 511
Join date : 2014-07-09

https://homesteadtinkerer.forumotion.com

Back to top Go down

File sharing between linux and android Empty Re: File sharing between linux and android

Post by Admin Tue Apr 26, 2022 3:05 pm

Oh my really got into this.  Using ES on phone as FTP server and either Filezilla or Midnight Commander as client on computer works pretty well.  As long as you become familiar with ES and avoid the "gotcha" buttons that pop up ads and their desire for you to make an online account.  I like server on phone cause you use the client to move files and its easier on large screen.  MC is good file manager whatever, just that it does have FTP option.  Oh also found out Firefox and Chrome no longer support FTP.  They didnt have more than marginal FTP support but now have none.  Most people already have one of those installed.  I think PaleMoon browser still supports FTP as does Konqueror.   Though not sure anybody still uses Konqueror as a browser, more as a file manager for KDE desktop.

Now got samba working...

I gleaned the simplified method of samba setup from here: https://www.instructables.com/How-to-se ... le-server/

You of course dont need sudo in Puppy. I tried this on MX cause thats what I had booted, so did need sudo.

start your adhoc wifi network and connect your phone.

   Samba already installed so...

   Then add the users to Samba by typing this into terminal e.g
   sudo smbpasswd -a Thermoelectric
   Replace Thermoelectric with your user name

   Start Samba by executing this in terminal
   sudo nmbd; smbd;

   Configure the /export directory:
   sudo mkdir /export
   sudo chown Thermoelectric.users /export
   sudo chmod u=rwx,g=rwx,o-rwx /export

   Check that Samba is running correctly:

   sudo smbclient -L localhost -U%

Now setup whatever client you want on your phone. There are loads of options so find one you are comfortable with. AndSMB is small but you manually do it. I found one called Ghost Commander incredibly easy. Navigate to your computer, when you get to that point it will ask for you samba username and password. Bingo you then get access to your computer files in right hand pane of two pane file manager setup. Seriously easy. But NOBODY ever really explains this stuff in dummy recipe mode.

Update that, after using both as samba client, think I like AndSMB better. Easier to interact with on phone small screen.

Then it was mentioned by rufwoof on Puppy forum there is a tiny FTP server included in Busybox mini CLI apps collection. Its called tvcscp. I have been using MX for this which doesnt use Busybox. To get tvcscp, you have to 'sudo apt install ipsvd'. Its tiny, trivial difference.

mkdir /ftp # where files will be down/up loaded from/to
chmod a+wrx /ftp # make it open to all
tcpsvd -vE 0.0.0.0 21 ftpd -w /ftp

This after you have wifi network of some kind. ruwoof just set his phone to hotspot and used that network. Its lockedon my phone, I use create_ap and then connect phone via wifi. No internet, just local adhoc network.

Then had Ghost Commander already installed on phone. I didnt really like it as samba client, but it works quite well as FTP client in combination of tcpsvd server on computer.

Admin
Admin

Posts : 511
Join date : 2014-07-09

https://homesteadtinkerer.forumotion.com

Back to top Go down

File sharing between linux and android Empty Re: File sharing between linux and android

Post by Admin Tue Apr 26, 2022 3:14 pm

Anyway lot choices servers/clients to move files around wirelessly. Find a combo that works for you. I'd avoid apps on phone that want to show ads or collect data, some are truly obnoxious. Open source apps the best, but some with maybe an upgrade button, but not obnoxious about it. I personally prefer server on phone and client on computer, just cause one uses client to move stuff and easier to interact with client on computer side. I didnt try any of these setups in combination with scrcpy which mirrors phone screen onto computer and lets you interact with mouse and normal keyboard. No squinting.

Admin
Admin

Posts : 511
Join date : 2014-07-09

https://homesteadtinkerer.forumotion.com

Back to top Go down

File sharing between linux and android Empty Re: File sharing between linux and android

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum