You are not logged in.

#1 2022-01-03 18:42:39

nandi
Member
Registered: 2021-07-16
Posts: 14

Share external usb with ftp

Hi Guys

I am looking for a solution how to share my external usb hdd with ftp for my phone to save backup information from the phone.
I tried Vsftpd it does not allow me to log in after i allowed write access on chroot directory which is under /mount.
Someone said would need to change the mount point under fstab to /home could help. Which would be the last resort is there any other way to do this? I am reluctant to use samba.

Offline

#2 2022-01-03 19:30:45

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,516

Re: Share external usb with ftp

Have a look at the Arch Wiki entry vsftpd.

Some basic configuration options, and I think your issue is in the "Troubleshooting" section.


You must unlearn what you have learned.
    -- yoda

Offline

#3 2022-01-04 15:23:09

twoion
一期一会
Registered: 2015-08-10
Posts: 3,436

Re: Share external usb with ftp

nandi wrote:

Hi Guys

I am looking for a solution how to share my external usb hdd with ftp for my phone to save backup information from the phone.
I tried Vsftpd it does not allow me to log in after i allowed write access on chroot directory which is under /mount.
Someone said would need to change the mount point under fstab to /home could help. Which would be the last resort is there any other way to do this? I am reluctant to use samba.

Those old FTP daemons like vsftpd are hard to configure.

I would suggest something different: Just use rclone's serve ftp functionality for zero-configuration FTP access. Impossible to get wrong and no need to configure some opaque FTP daemon. For the task you're describing, you do not need any of the advanced functionality those daemons offer. You can make do using simple tooling.

1. Download the latest rclone package https://downloads.rclone.org/v1.57.0/rc … -amd64.deb and install it with gdebi or from the command line using "sudo dpkg -i path.to.the.package.deb"

2. Make sure you're running as a local user on your machine that has write and read access to the /mount directory, or  /mount/otherdirectory if that's where the data should go.

3. Run rclone as that user in the terminal and tell it to serve /mount (or the other directory) over ftp:

rclone serve ftp --addr 0.0.0.0:2121 --user ftp --pass ftp /mount

The FTP server should now be reachable on your LAN at <your computer's IP address> and port 2121. You can change the IP address from 0.0.0.0 to bind to a specific IP, for example just the LAN IP. You can leave off the user and pass parameters in which case rclone allows anonymous access. See https://rclone.org/commands/rclone_serve_ftp/ in case you want to the read the entire documentation on the functionality. The reason why we're using port 2121 is that binding to port 21 requires elevated net bind capabilities which automatically are only granted to root, so by using 2121 we don't necessarily need to run as root.

And that's it. After you're done, just kill the rclone process in its terminal window using ctrl+c.

PS. You can also do this in reverse. You can also install RCX, a rclone wrapper for Android from the playstore here https://play.google.com/store/apps/deta … l=en&gl=US. Then in RCX, you can create a FTP server that serves your Android internal or SD card storage over FTP. In this reverse scenario, you would then use the FTP client on your PC to download the data from Android and save it on the USB drive. RCX is free and open source btw, the source code is on github here: https://github.com/x0b/rcx . I'm using RCX myself heavily to replace proprietary cloud sync solutions.

PPS. Yet another approach if you're on Android would be using termux https://termux.com/. In termux, you would install a SSH daemon or FTP daemon https://wiki.termux.com/wiki/Remote_Access . Then you could again download data to your computer using SSH (SFTP!) transport or FTP. A drawback of termux is that it cannot access SD card storage via storage access framework, which makes it less attractive to use for this job on Android 11 and later, in which case RCX/rclone is the better choice.

Offline

Board footer

Powered by FluxBB