Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] How to: access phone storage over USB via FTP?

OP bflmpsvz

25th May 2014, 09:31 PM   |  #1  
OP Senior Member
Thanks Meter: 13
 
215 posts
Join Date:Joined: Jan 2013
Hi, I learned my phone allows in over USB connection only 2 connect modes: MTP and PTP, no mass sorage or mass storage with big limitations.
In app description on Google play I found this workflow to access phone filesystem from PC over USB:

Quote:

How to connect with Ftp server using USB cable:

This can useful when you have USB cable and not network available.
1) On your phone go to Settings->Applications->Development and set option "USB debugging".
2) Connect your phone to your PC using USB cable.
3) Start adb server. On your PC run command "adb start-server".
adb is a program that you can find on android sdk. Usually you will find it on android-sdk\platform-tools\adb.
4) Forward needed ports from your PC to your phone. On your PC run command "adb forward tcp:2221 tcp:2221"
You will need to repeat this step for all ftp server and passive ports configured in your phone. It will be easier if you use a small range of passive ports.
With this, any connection in your pc to 127.0.0.1:2221 will be forwarded to your phone in port 2221.
5) Run Ftp server in your phone, open settings and in "Network interfaces" select "Loopback (127.0.0.1)" or "All"
6) Start ftp server.
7) In your PC connect your ftp client to ftp://127.0.0.1:2221 (port might be different, it depends on your Ftp Server configuration).

Connections in this mode need to be always started by PC so only passive mode is available when using USB connection.

Followed it except I use FTPdroid (FTP server too).

$ adb start-server
$ adb forward tcp:5221 tcp:21

now start a FTP client and connect using ftp://ASUS@127.0.0.1:5221/
I was almost able to connect till 21:22:03 when "Connection refused"

Code:
[21:22:01] [R] Connecting to Xperia P - FTPDroid over USB -> IP=127.0.0.1 PORT=5221
[21:22:01] [R] Connected to Xperia P - FTPDroid over USB
[21:22:01] [R] 220---------- Welcome to Pure-FTPd ----------
[21:22:01] [R] 220-You are user number 1 of 50 allowed.
[21:22:01] [R] 220-Local time is now 20:22. Server port: 21.
[21:22:01] [R] 220-This is a private system - No anonymous login
[21:22:01] [R] 220-IPv6 connections are also welcome on this server.
[21:22:01] [R] 220 You will be disconnected after 15 minutes of inactivity.
[21:22:01] [R] USER ASUS
[21:22:01] [R] 331 User ASUS OK. Password required
[21:22:01] [R] PASS (hidden)
[21:22:01] [R] 230 OK. Current directory is /
[21:22:01] [R] SYST
[21:22:01] [R] 215 UNIX Type: L8
[21:22:01] [R] FEAT
[21:22:01] [R] 211-Extensions supported:
[21:22:01] [R]  EPRT
[21:22:01] [R]  IDLE
[21:22:01] [R]  MDTM
[21:22:01] [R]  SIZE
[21:22:01] [R]  REST STREAM
[21:22:01] [R]  MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
[21:22:01] [R]  MLSD
[21:22:01] [R]  UTF8
[21:22:01] [R]  ESTA
[21:22:01] [R]  PASV
[21:22:01] [R]  EPSV
[21:22:01] [R]  SPSV
[21:22:01] [R]  ESTP
[21:22:01] [R] 211 End.
[21:22:01] [R] OPTS UTF8 ON
[21:22:01] [R] 200 OK, UTF-8 enabled
[21:22:01] [R] PWD
[21:22:01] [R] 257 "/" is your current location
[21:22:01] [R] PASV
[21:22:01] [R] 227 Entering Passive Mode (127,0,0,1,201,216)
[21:22:01] [R] Opening data connection IP: 127.0.0.1 PORT: 51672
[21:22:03] [R] Data Socket Error: Connection refused
[21:22:04] [R] List Error
[21:22:04] [R] PASV mode failed, trying PORT mode.
[21:22:04] [R] Listening on PORT: 33725, Waiting for connection.
[21:22:04] [R] PORT 127,0,0,1,131,189
[21:22:04] [R] 200 PORT command successful
[21:22:04] [R] MLSD
[21:22:04] [R] 425 Could not open data connection to port 33725: Connection refused
[21:22:05] [R] List Error
[21:22:06] [R] QUIT
[21:22:06] [R] 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
[21:22:06] [R] 221 Logout.
[21:22:06] [R] Logged off: Xperia P - FTPDroid over USB (Duration: 5 seconds)
Can someone explain what's wrong and why no listing. Btw. I turned off firewall for the moment, no work though.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes