Giter VIP home page Giter VIP logo

Comments (3)

adiroiban avatar adiroiban commented on June 14, 2024

Thanks for the report.

The default anonymous user is not allowed to upload files

see the source code

def openForWriting(self, path):
"""
Reject write attempts by anonymous users with
L{PermissionDeniedError}.
"""
return defer.fail(PermissionDeniedError("STOR not allowed"))

Is there any documentation for Twisted describing that the anonymous user has write access by default?


Regarding non-anonymous users, the current ftp TAP does not support custom home paths for non-anoymous users.

def makeService(config):
f = ftp.FTPFactory()
r = ftp.FTPRealm(config["root"])
p = portal.Portal(r, config.get("credCheckers", []))

The twistd root is passes as the anonymous root, and the non anonmous user home directory is is harcoded to the default /home/$USERNAME

Is there any documentation for Twisted FTP application suggesting that this is supported?


I would consider this a feature request,

The current options for FTP tap are here

class Options(usage.Options, strcred.AuthOptionMixin):
synopsis = """[options].
WARNING: This FTP server is probably INSECURE do not use it.
"""
optParameters = [
["port", "p", "2121", "set the port number"],
["root", "r", "/usr/local/ftp", "define the root of the ftp-site."],
["userAnonymous", "", "anonymous", "Name of the anonymous user."],
]
compData = usage.Completions(
optActions={"root": usage.CompleteDirs(descr="root of the ftp site")}

You can look into extending the code to support non-anonymous user home folder.

I am happy to review a PR for this.

I have updated the title of this issue to reflect the current issue.

FTP upload works... it just that you will need to store all the FTP user files inside a "/home/$USER/" directory

from twisted.

vhdumann avatar vhdumann commented on June 14, 2024

Thank you for the quick feedback, it explains a lot.

Is there any documentation for Twisted describing that the anonymous user has write access by default?

I may have had wrong expectations what the CLI tool was about. Background: I wanted a minimal FTP server solution to test a client. Without the need to setup real system users etc. And in my opinion the tool implied this by allowing to pass users and passwords as arguments and supporting anonymous access. I would expect that support of anon uploads is the more obvious use case for a test server and not supporting it would be the thing that has to be documented. Differentiating between anonymous and user downloads and uploads respectively probably took explicit implementation work. And I don't really see why. The help segment warns that the tool is insecure, great, I want to do insecure things for testing.

Is there any documentation for Twisted FTP application suggesting that this is supported?

The help output says "define the root of the ftp-site" which to me implies I can choose the default path for file transfers
Also even if I run twistd -n ftp --auth file:pass.dat, write <user>:<password> of my local system user into the pass.dat (I would expect to be able to define arbitrary credentials here) and then use this non-anonymous user to upload or download via curl I still receive 530 access denied without any feedback on the tool side.

from twisted.

adiroiban avatar adiroiban commented on June 14, 2024

I have never used the Twsited Application framework and TAP file.
I don't think this was explicitly designed for testing usage.


FTP anonymous is kind of a legacy implementation of a public download site.
I think it is expected to have read-only for anonymous FTP

If you want to write, you can create an user.

For testing , you can have something like this

-r = ftp.FTPRealm(config["root"])
+r = ftp.FTPRealm(anonymousRoot=config["root"], userHome="/tmp")

Then you will need to create /tmp/USERNAMES folder

The help output says "define the root of the ftp-site" which to me implies I can choose the default path for file transfers

Thanks. True.
It should say. "Defines the root of the anonymos site."

from twisted.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.