The situation:
I'm trying to code a ftp file auto up and download program. It will iterate through my files and auto upload new files. The ftp server is build into my wifi router. I have included the ftp-server into my Ubuntu filesystem and everything work's fine (I can access everything). The home site is like family folders and my own folder.
Now my problem:
So far I was able to connect to the server and change into my directory and list the folders. But if I want to change from this directory into e.g. C++ (it's a folder inside my directory), I'll get an error message saying "Permission denied". The user account used to login is the same used in my file-system inclusion.
The python 3 code:
from ftplib import FTP_TLS
class ftp_client():
def __init__(self, host, unandpw):
self.host = host
self.logindata = unandpw #should be a touple
self.ftp = FTP_TLS(self.host)
self.ftp.login(self.logindata[0], self.logindata[1])
self.ftp.prot_p()
def scan(self):
self.ftp.cwd("/" + self.logindata[0] + "/")
self.listoffiles = self.ftp.nlst()
print("list of files: " + str(self.listoffiles))
for file in self.listoffiles:
self.ftp.cwd("/" + str(file) + "/")
self.listoffilesinfiles = self.ftp.nlst()
print(self.listoffilesinfiles)
self.ftp.cwd("/" + self.logindata[0] + "/")
I'm calling it via an external main file...
The console output:
list of files: ['C++', 'Documents', 'Pictures', 'Python', 'School',
'share', 'Videos']
Traceback (most recent call last):
File "main.py", line 5, in <module>
ftp.scan()
File "/home/simon/Python/autoserversync/client.py", line 18, in scan
self.ftp.cwd("/" + str(file) + "/")
File "/usr/lib/python3.5/ftplib.py", line 630, in cwd
return self.voidcmd(cmd)
File "/usr/lib/python3.5/ftplib.py", line 277, in voidcmd
return self.voidresp()
File "/usr/lib/python3.5/ftplib.py", line 250, in voidresp
resp = self.getresp()
File "/usr/lib/python3.5/ftplib.py", line 245, in getresp
raise error_perm(resp)
ftplib.error_perm: 550 /C++/: Permission denied.
Now my question (obviously) is: how can I fix this?