I want to connect to my own ftp server and its not working. Tried other ftp server, which are working, but my server is working just fine with filezilla and some ftp testing tools say, that the server is okay. I think the server ist sending a command n8n dont know, but i dont know how to know which command that is. I would prefer n8n ignoring unknown command instead of aborting.
What is the error message (if any)?
Error: Unknown command
at makeError (/usr/local/lib/node_modules/n8n/node_modules/@icetee/ftp/lib/connection.js:1128:13)
at Parser.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/@icetee/ftp/lib/connection.js:122:25)
at Parser.emit (events.js:315:20)
at Parser._write (/usr/local/lib/node_modules/n8n/node_modules/@icetee/ftp/lib/parser.js:61:10)
at writeOrBuffer (internal/streams/writable.js:358:12)
at Parser.Writable.write (internal/streams/writable.js:303:10)
at Socket.ondata (/usr/local/lib/node_modules/n8n/node_modules/@icetee/ftp/lib/connection.js:298:20)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Please share the workflow
Its only a ftp node im trying it with
Information on your n8n setup
n8n version: latest ( 0.156.0 )
Database you’re using (default: SQLite): postgres
Running n8n with the execution process [own(default), main]:
Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker (production) and desktop (testing)
Hi @KnudH, welcome to the community and sorry to hear you’re running into trouble. I’ve just tested the FTP node on my end and didn’t run into any trouble here though:
I’ve tested this using my own server as well as via this test server.
Are you by any chance using the wrong protocol in the node or have set the wrong port number in your credentials? FileZilla might detect the correct settings automatically, but n8n wouldn’t do any auto-configuration here.
Port ist default. (21). This is configured in FileZilla and n8n.
Protocoll is FTP, SFTP is not working with this server. TLS or not both is working with this server and so it is in FileZilla. I cant choose which I want in n8n (or am I wrong?).
Connection to the test server you mentioned is working just fine. Difference in FileZilla ist, that the testserver uses TLS 1.2 and my server uses TLS 1.3 (dont know if that matters).
Protocoll of FileZilla connecting to my server:
|Status:|Auflösen der IP-Adresse für ftp.xxx.xx|
|Status:|Verbinde mit XX.XX.XXX.XXX:21…|
|Status:|Verbindung hergestellt, warte auf Willkommensnachricht…|
|Antwort:|220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------|
|Antwort:|220-You are user number 1 of 50 allowed.|
|Antwort:|220-Local time is now 10:34. Server port: 21.|
|Antwort:|220-This is a private system - No anonymous login|
|Antwort:|220-IPv6 connections are also welcome on this server.|
|Antwort:|220 You will be disconnected after 15 minutes of inactivity.|
|Befehl:|AUTH TLS|
|Antwort:|234 AUTH TLS OK.|
|Status:|Initialisiere TLS…|
|Status:|TLS-Verbindung hergestellt.|
|Befehl:|USER dlrgrd_cloud_scans|
|Antwort:|331 User dlrgrd_cloud_scans OK. Password required|
|Befehl:|PASS *************|
|Antwort:|230 OK. Current restricted directory is /|
|Befehl:|OPTS UTF8 ON|
|Antwort:|200 OK, UTF-8 enabled|
|Befehl:|PBSZ 0|
|Antwort:|200 PBSZ=0|
|Befehl:|PROT P|
|Antwort:|200 Data protection level set to private|
|Status:|Angemeldet|
|Status:|Empfange Verzeichnisinhalt…|
|Befehl:|PWD|
|Antwort:|257 / is your current location|
|Status:|Anzeigen des Verzeichnisinhalts fĂĽr / abgeschlossen|
Though since you’ve mentioned FTP without TLS should also work (or in other words plain/insecure FTP), I am a bit puzzled what’s the issue here. The TLS version shouldn’t matter in this case. I have also tried running Pure-ftpd (which seems to power your server) myself. This was working fine with n8n, so I could not reproduce this even when running the same FTP server.
Would you be able to confirm which provider is hosting your FTP server? That might help with reproducing what might be happening here.
Also, could you double-check your server actually works without TLS? The Filezilla log you have shared suggests it’s being used. This would need to be set in the Encryption field:
Im hosting the server myself. Im running ISPConfig which brings pureftp.
Log with TLS disabled:
|Status:|Auflösen der IP-Adresse für ftp.xxx.xx|
|Status:|Verbinde mit XX.XX.XX.XX:21…|
|Status:|Verbindung hergestellt, warte auf Willkommensnachricht…|
|Antwort:|220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------|
|Antwort:|220-You are user number 1 of 50 allowed.|
|Antwort:|220-Local time is now 21:09. Server port: 21.|
|Antwort:|220-This is a private system - No anonymous login|
|Antwort:|220-IPv6 connections are also welcome on this server.|
|Antwort:|220 You will be disconnected after 15 minutes of inactivity.|
|Status:|UnverschlĂĽsseltes FTP ist unsicher. Bitte wechseln Sie zu FTP ĂĽber TLS.|
|Befehl:|USER dlrgrd_cloud_scans|
|Antwort:|331 User dlrgrd_cloud_scans OK. Password required|
|Befehl:|PASS *************|
|Antwort:|230 OK. Current restricted directory is /|
|Befehl:|OPTS UTF8 ON|
|Antwort:|200 OK, UTF-8 enabled|
|Status:|Angemeldet|
|Status:|Empfange Verzeichnisinhalt…|
|Befehl:|PWD|
|Antwort:|257 / is your current location|
|Status:|Anzeigen des Verzeichnisinhalts fĂĽr / abgeschlossen|
Which protocol are you trying to use? FTPS is not fully supported although from what I remember it may only be implicit, Explicit may still work. Plain FTP while unsecure should still work but personally I have always preferred SFTP for file transfers.
What FTP server are you trying to connect to as well is it PureFTP as well or something else?
It’s not my server, so I don’t have control of that - unfortunately - so SFTP is not an option.
Connecting via plain FTP through filezilla on the same rig as my n8n instance is fine, though it throws a certificate warning, which i guess means it’s switching to FTPS automatically.
I’m back in my server room on Friday, so i’ll pull a log there, and post so you can see exactly what is going on, but this is the log from dreamweaver at home:
< 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
< 220-You are user number 1 of 50 allowed.
< 220-Local time is now 10:15. Server port: 21.
< 220-This is a private system - No anonymous login
< 220 You will be disconnected after 15 minutes of inactivity.
> USER [email protected]
< 331 User [email protected] OK. Password required
> PASS
< 230 OK. Current restricted directory is /
> PWD
< 257 "/" is your current location
> CWD /
< 250 OK. Current directory is /
> CWD /
< 250 OK. Current directory is /
> MKD MM_CASETEST4291
< 257 "MM_CASETEST4291" : The directory was successfully created
> RMD MM_CASETEST4291
< 250 The directory was successfully removed
> PORT 192,168,0,19,254,162
< 200 PORT command successful
> TYPE A
< 200 TYPE is now ASCII
> LIST
< 150 Connecting to port 65186
< drwx--x--x 28 biketrax biketrax 4096 Feb 16 10:15 .
< drwx--x--x 28 biketrax biketrax 4096 Feb 16 10:15 ..
< drwx------ 2 biketrax biketrax 78 Sep 22 2018 .autorespond
< -rw-r--r-- 1 biketrax biketrax 304 Mar 2 2006 .bash_logout
< -rw-r--r-- 1 biketrax biketrax 191 Mar 2 2006 .bash_profile
< -rw-r--r-- 1 biketrax biketrax 124 Mar 2 2006 .bashrc
< -rw------- 1 biketrax biketrax 19 Aug 24 2005 .contactemail
< drwxr-xr-x 3 biketrax biketrax 23 Dec 6 2007 .cpaddons
< drwx------ 6 biketrax biketrax 4096 Feb 15 15:55 .cpanel
< -rw------- 1 biketrax biketrax 5198 Nov 26 2004 .cpanel-ducache
< -rw------- 1 biketrax biketrax 0 Jan 15 2013 .cpanel-logs
< drwx------ 4 biketrax biketrax 66 Feb 2 09:16 .cphorde
< -rw-r--r-- 1 biketrax biketrax 14 Jul 16 2015 .dns
< -rw-r--r-- 1 biketrax biketrax 589 Dec 5 2008 .filter
< -rw------- 1 biketrax biketrax 18 Feb 3 03:08 .ftpquota
< -rw-r--r-- 1 biketrax biketrax 964 Oct 25 2016 .htaccess
< drwxr-x--- 2 biketrax 99 6 Oct 21 2009 .htpasswds
< -rw------- 1 biketrax biketrax 618 Feb 5 14:45 .lastlogin
< drwx------ 2 biketrax biketrax 6 Dec 6 2004 .neomail
< drwxr-xr-x 2 biketrax biketrax 4096 Nov 12 11:55 .razor
< drwx------ 2 biketrax biketrax 98 Feb 16 08:54 .spamassassin
< drwx------ 2 biketrax biketrax 4096 Feb 21 2019 .sqmailattach
< drwx------ 2 biketrax biketrax 4096 Feb 21 2019 .sqmaildata
< drwx------ 2 biketrax biketrax 27 Nov 10 2016 .subaccounts
< drwx------ 2 biketrax biketrax 6 Oct 25 2016 .trash
< -rw-r--r-- 1 biketrax biketrax 658 Nov 20 2015 .zshrc
< lrwxrwxrwx 1 biketrax biketrax 34 Jun 6 2011 access-logs -> /usr/local/apache/domlogs/biketrax
< drwxr-xr-x 2 biketrax biketrax 6 Nov 23 2016 biketrax.co.uk
< drwxr-xr-x 2 biketrax biketrax 8192 Aug 4 2016 cache
< -rw-r----- 1 biketrax biketrax 0 Feb 27 2009 cpbackup-exclude.conf
< drwxr-xr-x 2 biketrax biketrax 6 Jun 6 2011 cpmove.psql
< drwxr-xr-x 2 biketrax biketrax 6 Mar 16 2010 cpmove.psql.1307367202
< drwxr-x--- 3 biketrax 12 74 Feb 15 15:55 etc
< drwx------ 2 biketrax biketrax 6 Feb 16 03:38 logs
< drwxr-xr-x 2 biketrax biketrax 6 Feb 14 13:28 lukiad
< drwxr-x--x 14 biketrax biketrax 4096 Feb 2 09:16 mail
< drwxr-xr-x 4 biketrax biketrax 26 Oct 29 2019 perl5
< drwxr-xr-x 3 biketrax biketrax 21 Dec 6 2007 public_ftp
< drwxr-x--- 29 biketrax 99 4096 Feb 4 2021 public_html
< drwxr-xr-x 5 biketrax biketrax 72 Jan 4 23:16 ssl
< drwx------ 8 biketrax biketrax 12288 Feb 21 2019 tmp
< drwxr-xr-x 3 biketrax biketrax 19 Feb 10 2016 var
< drwxr-x--- 29 biketrax 99 4096 Feb 4 2021 www
< 226-Options: -a -l
< 226 43 matches total
> CWD /
< 250 OK. Current directory is /
> CWD /access-logs
< 550 Can't change directory to /access-logs: No such file or directory
So I suspect this could be down to where FTPS is not fully supported and it would need a change to the node to allow it to work properly. As a temporary solution if SFTP can’t be enabled the other option may be to enable plain FTP which isn’t ideal.
I’ve managed to persuade the server owner to allow plain FTP, and filezilla can connect using this protocol.
I’m now getting:
{"code":500}
And:
NodeApiError: The service was not able to process your request
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Ftp/Ftp.node.js:493:43)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:47
I don’t believe this is the same issue. If i switch the binary data property off, and try to insert raw text, i get an error code further in ftp.node.js:508.
Status: Resolving address of ftp.biketrax.co.uk
Status: Connecting to 93.174.137.99:21...
Status: Connection established, waiting for welcome message...
Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Response: 220-You are user number 4 of 50 allowed.
Response: 220-Local time is now 08:00. Server port: 21.
Response: 220-This is a private system - No anonymous login
Response: 220 You will be disconnected after 15 minutes of inactivity.
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Command: USER [email protected]
Response: 331 User [email protected] OK. Password required
Command: PASS ************
Response: 230 OK. Current restricted directory is /
Command: OPTS UTF8 ON
Response: 504 Unknown command
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is your current location
Status: Directory listing of "/" successful
That’s the log from filezilla - is there a n8n connection log buried somewhere?
You can enable file logging for n8n but I am not sure you will get the same level of output, In your node is it just a list action you are performing in the node?
I have a couple of bits I need to sort out this morning but I will work on getting a Pure FTP server set up to do some testing with.
I’ve tried both list and file upload, both get 500. Ultimately I’m looking to upload a spreadsheet file generated in the previous node.
As I said earlier, the error throws on a different line in the JS dependant on whether the binary file flag is true/false, so i’m thinking it’s a bug in the ftp node but it’s odd that all commands return a similar error.
It could be a bug in the node but oddly enough not one I have ran into when using it so I am wondering if it is something with the FTP node that is only an issue with Pure FTP.
I will let you know when I have had more of a play.
That makes sense, I would expect it to be a different line depending on the action, It will just be a case of trying to work out what the command is which shouldn’t take long once I have the environment set up.
I may look at adding in the TLS support at the same time.