FTP not connection at script level

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
Hi,

I switched from proftp to pureftp and ever since then i cannot connect using my ftp at script level. I was able to get filezilla working, however at script level (such as a wordpress level) it wont connect. I dont use wordpress, i use another software however im sure its probably a similar issue with all script level issues, so i have been looking at the wordpress forum to see if i can find something to try to get my program to connect.

My program allways connected before fine on proftp, im not sure what the issue is. But i have tried everything i know how to do, i have used the localhost, the ftp.example.com, the hostname.example.com, no port at all because pureftp is passive, i have tried everything.

Today i ran into this little bit of code that seems to help wordpress users connect if its broken but dont know what it does.

Can someone please explain this to me before i try it?

I know that it changes the permission but why would those permissions fix the issue. I am not understanding the www-data- and /var/www relationships i guess.

And do you have any suggestions what i might try next?

Code:
chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;
thanks :)
 
Last edited:

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
OK so i ran a script to test the connection at site level in the same folder..

and it came back as this

PHP Warning: ftp_login(): Please reconnect using TLS security mechanisms. in /home/username/public_html/subsite/testcon.php on line 48
never seen that before...

so then i did the connection using this format adding ftpes://

Code:
host : ftpes://domain.com
and i get this

PHP Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
this is that line

Code:
        $con = ftp_connect($host, $port, $timeout);
 
Last edited:

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
GOT IT !!! in WHM under ftp server config i changed the TLS encryption support to optional. And using the main cpanel user i can use the ftp at site level.

However, if i create a new ftp account, even when i assign them to the public_html, it comes back and tells me they dont have permission to change files.

So how do i fix that part?

for example if i created a ftp account for [email protected] how do i give ftptest permission to update files?

I checked who owned the files and its the domain username and not root... i always thought if the owner was the domain username that any ftp created under their umbrella also had write privileges. Is that not true?
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
However, if i create a new ftp account, even when i assign them to the public_html, it comes back and tells me they dont have permission to change files.

So how do i fix that part?

for example if i created a ftp account for [email protected] how do i give ftptest permission to update files?

I checked who owned the files and its the domain username and not root... i always thought if the owner was the domain username that any ftp created under their umbrella also had write privileges. Is that not true?
Hello,

Are you sure you are accessing the directory that's assigned to the FTP account, or a subdirectory beneath it? Are you attempting to download/upload files when you receive that error message, or change the permissions of the files?

Thank you.