How to provide username and password within FTP URL for direct download in a browser?

15,857

Solution 1

You can provide the credentials to the URL like so:

username:password@host

Your example would become:

ftp://username:[email protected]/my-file.csv

You will run into problems if the user name contains invalid symbols such as @:

 ftp://usern@me:[email protected]/my-file.csv

For such a download, I had to fallback on using a client allowing the symbol, e.g. FileZilla.

Solution 2

Notable exception (for HTTP and HTTPS protocols) is IE:

Internet Explorer versions 3.0 to 6.0 support the following syntax for HTTP or HTTPS URLs: http(s)://username:password@server/resource.ext You can use this URL syntax to automatically send user information to a Web site that supports the basic authentication method.

(Source). They do not support it for security concerns:

A malicious user might use this URL syntax to create a hyperlink that appears to open a legitimate Web site but actually opens a deceptive (spoofed) Web site. For example, the following URL appears to open http://www.wingtiptoys.com but actually opens http://example.com: http://[email protected]

Share:
15,857

Related videos on Youtube

k0pernikus
Author by

k0pernikus

I am Philipp Kretzschmar, a backend developer from Hamburg working at Demvsystem. You can find me on github. Or twitter. My main weapons of choice are: php TypeScript (I don't want to write plain JavaScript anymore) and nodejs I play around with: Java python rust I used to write some scala, but for now I don't want to go there anymore. I feel most comfortable on a unix-like system featuring a powerful bash. (This excludes MacOS.) I love to code within JetBrains's flavored IDEs, e.g. IntelliJ, PhpStorm, WebStorm and using the IdeaVim plugin and having a docker-compose stack to develop on.

Updated on September 18, 2022

Comments

  • k0pernikus
    k0pernikus almost 2 years

    Modern browsers like Chrome and Firefox can handle FTP downloads:

    ftp://my-ftp.com/my-file.csv
    

    I want to share a link to another person and I don't want them to enter a username and password through a prompt.

    I am aware of the security impact, yet in this case ease of use has precedence. I wonder if there is an option to provide the credentials within the FTP URL directly.

  • k0pernikus
    k0pernikus over 6 years
    Does ie handle FTP at all?
  • mvw
    mvw over 6 years
    ftp.freebsd.org seems to work (IE11).