FTPIOError: 550 Permission denied

Need help with FileZilla Server? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
suyunming
500 Command not understood
Posts: 5
Joined: 2023-11-22 12:30
First name: yunming
Last name: su

FTPIOError: 550 Permission denied

#1 Post by suyunming » 2023-11-22 12:51

I installed FileZilla Server 1.7.3 on Win10, and I'm using the ftputil library in Python to connect to the FTP server and upload files. However, I'm getting an error: FTPIOError: 550 Permission denied.
---------------------------------------------------------------------------
error_perm Traceback (most recent call last)
File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\file.py:94, in FTPFile._open(self, path, mode, buffering, encoding, errors, newline, rest)
93 with ftputil.error.ftplib_error_to_ftp_io_error:
---> 94 self._conn = self._session.transfercmd(command, rest)
95 self._fobj = self._conn.makefile(
96 mode, buffering=buffering, encoding=encoding, errors=errors, newline=newline
97 )

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\ftplib.py:393, in FTP.transfercmd(self, cmd, rest)
392 """Like ntransfercmd() but returns only the socket."""
--> 393 return self.ntransfercmd(cmd, rest)[0]

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\ftplib.py:359, in FTP.ntransfercmd(self, cmd, rest)
358 self.sendcmd("REST %s" % rest)
--> 359 resp = self.sendcmd(cmd)
360 # Some servers apparently send a 200 reply to
361 # a LIST or STOR command, before the 150 reply
362 # (and way before the 226 reply). This seems to
363 # be in violation of the protocol (which only allows
364 # 1xx or error messages for LIST), so we just discard
365 # this response.

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\ftplib.py:281, in FTP.sendcmd(self, cmd)
280 self.putcmd(cmd)
--> 281 return self.getresp()

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\ftplib.py:254, in FTP.getresp(self)
253 if c == '5':
--> 254 raise error_perm(resp)
255 raise error_proto(resp)

error_perm: 550 Permission denied

The above exception was the direct cause of the following exception:

FTPIOError Traceback (most recent call last)
Cell In[26], line 10
8 print(ftp_host.listdir(ftp_host.curdir))
9 print("已打印")
---> 10 ftp_host.upload(local_directory,'/testftp')

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\host.py:526, in FTPHost.upload(self, source, target, callback)
524 target = ftputil.tool.as_str_path(target, encoding=self._encoding)
525 source_file, target_file = self._upload_files(source, target)
--> 526 ftputil.file_transfer.copy_file(
527 source_file, target_file, conditional=False, callback=callback
528 )

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\file_transfer.py:196, in copy_file(source_file, target_file, conditional, callback)
194 source_fobj = source_file.fobj()
195 try:
--> 196 target_fobj = target_file.fobj()
197 try:
198 copyfileobj(source_fobj, target_fobj, callback=callback)

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\file_transfer.py:103, in RemoteFile.fobj(self)
99 def fobj(self):
100 """
101 Return a file object for the name/path in the constructor.
102 """
--> 103 return self._host.open(self.name, self.mode)

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\host.py:272, in FTPHost.open(self, path, mode, buffering, encoding, errors, newline, rest)
265 except ftputil.error.PermanentError:
266 # Similarly to a failed `file` in a local file system, raise an
267 # `IOError`, not an `OSError`.
268 raise ftputil.error.FTPIOError(
269 "remote directory '{}' doesn't "
270 "exist or has insufficient access rights".format(effective_dir)
271 )
--> 272 host._file._open(
273 effective_file,
274 mode=mode,
275 buffering=buffering,
276 encoding=encoding,
277 errors=errors,
278 newline=newline,
279 rest=rest,
280 )
281 if "w" in mode:
282 # Invalidate cache entry because size and timestamps will change.
283 self.stat_cache.invalidate(effective_path)

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\file.py:93, in FTPFile._open(self, path, mode, buffering, encoding, errors, newline, rest)
91 command = "{} {}".format(command_type, path)
92 # Get connection and file object.
---> 93 with ftputil.error.ftplib_error_to_ftp_io_error:
94 self._conn = self._session.transfercmd(command, rest)
95 self._fobj = self._conn.makefile(
96 mode, buffering=buffering, encoding=encoding, errors=errors, newline=newline
97 )

File C:\ProgramData\anaconda3\envs\watchdog_test20231121\Lib\site-packages\ftputil\error.py:226, in FtplibErrorToFTPIOError.__exit__(self, exc_type, exc_value, traceback)
224 return
225 if isinstance(exc_value, ftplib.all_errors):
--> 226 raise FTPIOError(*exc_value.args, original_error=exc_value) from exc_value
227 else:
228 raise

FTPIOError: 550 Permission denied
Debugging info: ftputil 5.0.4, Python 3.11.6 (win32)


python as below:
import ftputil
import ftplib
import os
import ftputil.session

my_session_factory = ftputil.session.session_factory(port=30021)
# 在 ftp_account 参数中指定模式
with ftputil.FTPHost(server, user, password, session_factory=my_session_factory) as ftp_host:
print("打印")
print(ftp_host.listdir(ftp_host.curdir))
print("已打印")
ftp_host.upload(local_directory,'/testftp')

The configuration of FileZilla Server is normal, and both read and write permissions have been granted.

User avatar
botg
Site Admin
Posts: 35566
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: FTPIOError: 550 Permission denied

#2 Post by botg » 2023-11-22 21:48

Please post a complete and unmodified server log of a session leading to the error.

suyunming
500 Command not understood
Posts: 5
Joined: 2023-11-22 12:30
First name: yunming
Last name: su

Re: FTPIOError: 550 Permission denied

#3 Post by suyunming » 2023-11-24 02:48

The issue has been resolved. The reason was that I directly uploaded a folder (including both the folder and its subfolders) without creating a folder, which does not conform to the usage of the Python library package.

Post Reply