-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twistd FTP TAP server allow configuring user home folder from twistd CLI #12126
Comments
Thanks for the report. The default anonymous user is not allowed to upload files see the source code twisted/src/twisted/protocols/ftp.py Lines 1893 to 1898 in 1c80aad
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. twisted/src/twisted/tap/ftp.py Lines 51 to 55 in 1c80aad
The 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 twisted/src/twisted/tap/ftp.py Lines 18 to 29 in 1c80aad
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 |
Thank you for the quick feedback, it explains a lot.
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.
The help output says "define the root of the ftp-site" which to me implies I can choose the default path for file transfers |
I have never used the Twsited Application framework and TAP file. FTP anonymous is kind of a legacy implementation of a public download site. 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
Thanks. True. |
Describe the incorrect behavior you saw
I am not able to use
twist -n ftp
consistently for testing file uploads.Downloading files works as anonymous. But with auth=memory or file I receive 550 or 530 errors.
Uploading does not work with anonymous, memory or file authentication.
When using auth unix the file upload did work.
Describe how to cause this behavior
I run the server for example with
twistd -n ftp --auth anonymous --userAnonymous=test -r file_root
twistd -n ftp --auth memory:user:password -r file_root
twistd -n ftp --auth file:pass.dat -r file_root
twistd -n ftp --auth unix -r file_root
I try to upload with e.g.
curl -T example.txt ftp://test@localhost:2121/
curl -T example.txt ftp://user:password@localhost:2121/
orcurl -T example.txt -u user ftp://localhost:2121
curl: (25) Failed FTP upload: 550
for valid or invalid credentialscurl: (67) Access denied: 530
with valid or invalid credentialsWhat did you do to get it to happen?
Installed twisted (24.3.0) via pip (python 3.10)
Describe the correct behavior you'd like to see
Testing environment
Linux seccdev 5.4.0-173-generic #191-Ubuntu SMP Fri Feb 2 13:55:07 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
twistd (the Twisted daemon) 24.3.0
Copyright (c) 2001-2024 Twisted Matrix Laboratories.
See LICENSE for details.
attrs==23.2.0
Automat==22.10.0
constantly==23.10.4
hyperlink==21.0.0
idna==3.6
incremental==22.10.0
six==1.16.0
Twisted==24.3.0
typing_extensions==4.11.0
zope.interface==6.2
The text was updated successfully, but these errors were encountered: