Transfer files between the L5 and networked computers

FTP (File Transfer Protocol):
It’s fairly simple to set up password-protected FTP between the L5 and a storage drive attached to your wireless router (if it supports that), enabling you to move files around your network. The storage drive can even be a simple thumb drive.

Log in to your router and find the USB and FTP settings. Create a user name and password for your FTP activity, add read/write privileges, and optionally create a specific folder on the storage drive to use for file transfer.

On the L5, open the Files app (I’m using Nemo), and look for “Connect to Server” under the File menu at the top. Select it, and when the box pops up, fill in your router’s IP address, select FTP (with login), add the user name and password you just created, and the folder name you made, if any. Optionally choose Remember this password, and that’s basically it. (You might have to switch to landscape at some point to see all the buttons.)

Beside the menu item Network, you’ll now see your “server” location, where you can access that folder on your router to store a file to be picked up from your other computer when you’re ready. (You’ll need to create the FTP connection on the other computer(s) as well…a similar process.)

If I recall, file transfer from the L5 to a thumb drive is not yet implemented - @Purism, correct me if I’m wrong - so the router option is convenient for the time being. (Before I set this up, I had been moving screenshots and such by attaching them to a draft email, then picking them up on my laptop so I could post them in the forum.)

There are other ways to move files between machines on your home network:

  1. Using Terminal commands
  2. With shared network storage
  3. Etc.

Maybe some of you can explain them below for everybody’s benefit. :wink:

EDIT: Thanks to all who posted other and better methods below, exactly as I had hoped. Now we just need some brief tutorials or links to existing guides, so even the novices among us can do them.

4 Likes

As this develops, I’d add this to the community wiki, as part of the how-to’s, if it’s ok.

Yes, I was thinking that, too, especially if others post about alternate methods below. Then they can all be summarized together.

If your router supports FTP for sharing storage that is attached to your router then it probably supports SMB (Samba / Windows file sharing) too. That would be a second option to explore.

Security comment: Having storage attached to your router is somewhat exposing yourself. It gives you fewer options to put barriers between your storage and the internet … assuming that the intention is not to share your storage with the internet.

I can’t speak for Nemo but nautilus out-of-the-box seems to offer: ftp, nfs, smb, sftp, dav. That’s on a desktop / laptop. I can only guess whether those options would exist on your phone if and when nautilus is available or whether Nemo offers those same options.

One fun option, discussed previously I think, is to enable the SSH server on the phone … and then you can use sshfs on a desktop/laptop to access files directly on the phone. You could, alternatively, use an SFTP client (like FileZilla) on the desktop/laptop if you prefer. That is a different approach though because you are pushing/pulling on the desktop/laptop. (So that is the reverse of using sftp in Nemo, if Nemo supports that.)

Honestly, Linux probably offers too many options - and yet everyone’s environment is different.

The µSD card is an alternative if you intend to use sneakernet.

3 Likes

You’re wrong :wink: There was no automount, but it should be there now with latest updates (and you could always mount it manually of course). USB thumb drive then works exactly the same as microSD card (which in fact is also seen in the system as a USB mass storage device).

Yeah, scp is a natural way to transfer a file to/from the phone for me, it comes to me without even thinking :wink:

6 Likes

For completeness then, if you enable the SSH server on the phone, and command line is acceptable / desirable, you can also use the sftp command.


Another option, not sure of its current "working" status, is to plug the phone in to the desktop/laptop via USB and it may present its storage as a USB mass storage device to the desktop/laptop. Even if it only did that for the µSD card, that could still be used to exchange files, albeit more with a focus on bulk movement since it is inherently less convenient than using the network.
1 Like

PS I hesitate to “write up” any of this because I like to test what I have written and I have no way of testing. Soon though … :wink:

No out-of-box support for that right now. A sufficiently motivated user can set it up and export µSD card as a mass storage device by configuring USB gadgets (I’ve done that and it works ;)), or even set MTP responder up to export anything on a filesystem level (haven’t tried it personally yet, but I know that Mobian got it integrated so it should be possible to replicate their setup).

1 Like

Even found it:

#!/bin/sh
set -x
rmmod g_multi
rmmod g_ether
cd /sys/kernel/config/
cd usb_gadget
mkdir g1
cd g1
echo "0x316d" > idVendor
echo "0x4c05" > idProduct
echo "0xEF" > bDeviceClass
echo "0x02" > bDeviceSubClass
echo "0x01" > bDeviceProtocol
mkdir strings/0x409
echo "0123456789" > strings/0x409/serialnumber
echo "Purism, SPC" > strings/0x409/manufacturer
echo "Librem 5" > strings/0x409/product
mkdir functions/ecm.usb0
mkdir functions/acm.GS0
mkdir functions/mass_storage.0
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "CDC ACM+ECM" > configs/c.1/strings/0x409/configuration
echo "/dev/sda" > functions/mass_storage.0/lun.0/file
echo "Librem 5" > functions/mass_storage.0/lun.0/inquiry_string
ln -s functions/acm.GS0 configs/c.1
ln -s functions/ecm.usb0 configs/c.1
ln -s functions/mass_storage.0 configs/c.1
echo "38100000.usb" > UDC

This sets up a USB gadget with three functions - serial, ethernet and mass storage (with /dev/sda being exported). Make sure to unmount any SD partition before doing that though - it is a block level export (as opposed to other tech like MTP that exports things on a filesystem level), so it will be your PC that will mount these partitions on its own!

Related ticket: https://source.puri.sm/Librem5/linux-next/-/issues/182

5 Likes

Oh, yeah, MTP too.

As I said, almost too many options.

Over time, if looking to gain mainstream customers, I think MTP (or something functionally equivalent) is needed. Users of other phones have come to expect plugging in via USB as an option, and for it to work seamlessly out-of-the-box. USB has the advantage of better physical security (but watch out for “bad chargers”).

As you imply, MTP is safer than USB mass storage class because while some users will know to umount first if using mass storage class, many will not.

5 Likes

For my desktop to laptop I use Syncthing

For me it’s rsync which comes without thinking :wink: , which means I need ssh server running in the background

What would be awesome is to have an option to activate/deactivate SSH in the settings (if installed) !
Else, I will probably have 2 shortcuts, one to disable sshd, one to activate sshd (as I have on my actual pc)

2 Likes

Would be? It’s already there for ages :smiley:

3 Likes

So awesome that it already exists?: [MyL5] Received my Librem 5 (Evergreen)

Argh, beat me by 1 minute, @dos :slight_smile:

2 Likes

It doesn’t work for tinysshd though :stuck_out_tongue:
Edit: but yes it’s about sharing and tiny doesn’t give any other service but shell.

1 Like

@dos @kieran : Hey ! I missed that ! :heart: THAT’S AWESOME ! :smile:

1 Like

I’m planning on setting something up where whenever my home Wifi connects, mount my home server’s storage drive via NFS.
When Wifi disconnects, unmount.

I can browse the same drive via SMB on my Android but having this setup I think will be pretty slick.

Still need a good adaptive GUI file manager option though, but that is coming.

Edit: And only a few minutes later I happen across this: https://source.puri.sm/adrien.plazas/nautilus/-/commit/0732ac4a1dd3177c04384f1c55e05ed7fbf76e91

1 Like
1 Like

Yes! Thanks. I just checked and my USB-C to USB-A/micro-B drive now mounts automatically when inserted.

2 Likes

True story! A few years ago, Asus routers that had built-in USB/FTP/Samba were compromised because there was no password protection included. They’ve corrected that now. Still maybe not the best option, as you and others have pointed out.

2 Likes