简体   繁体   English

pyftpdlib拒绝os.makedirs权限

[英]pyftpdlib make os.makedirs permission denied

I am reading a ftp platform code based on pyftpdlib, and this code cannot run on my Linux. 我正在阅读基于pyftpdlib的ftp平台代码,并且该代码无法在我的Linux上运行。 I use sudo to ensure the permission. 我使用sudo来确保许可。

When pyftpdlib run my code and then my code run os.makedirs and this throw a permission error. 当pyftpdlib运行我的代码,然后我的代码运行os.makedirs时,这将引发权限错误。

I can run it in other python code without pyftpdlib. 我可以在没有pyftpdlib的其他python代码中运行它。

This is the Traceback: 这是回溯:

  File "/usr/lib64/python2.7/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib64/python2.7/asyncore.py", line 444, in handle_read_event
    self.handle_read()
  File "/usr/lib64/python2.7/asynchat.py", line 158, in handle_read
    self.found_terminator()
  File "pyftpdlib/ftpserver.py", line 2230, in found_terminator
    self.process_command(cmd, arg)
  File "pyftpdlib/ftpserver.py", line 2296, in process_command
    method(*args, **kwargs)
  File "pyftpdlib/ftpserver.py", line 3193, in ftp_PASS
    rst = self.authorizer.validate_authentication(self.username, line)
  File "ftp9/auth.py", line 42, in validate_authentication
    self._group_info.update(api)
  File "ftp9/group.py", line 64, in update
    self._update_fs()
  File "ftp9/group.py", line 143, in _update_fs
    walk(self._root, config.FTP_ROOT)
  File "ftp9/group.py", line 141, in walk
    walk(i, pjoin(rootdir, i.name))
  File "ftp9/group.py", line 125, in walk
    os.makedirs(pjoin(rootdir, i))
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
  OSError: [Errno 13] Permission denied: '/data/ftp/\xe6\x9c\xac\xe7\xa7\x91\xe7\x94\x9f/1997\xe7\xba\xa7'

This code will run on the Linux user "ftp", so It does not have the permission of the folder. 该代码将在Linux用户“ ftp”上运行,因此没有该文件夹的许可。 you should chown to give the permission. 你应该给我许可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM