Login authentication failed creating account

Ricardo Lobo

Member
Oct 11, 2016
23
2
3
Brazil
cPanel Access Level
Root Administrator
Hello, I could not find someone with the same problem. So I decided to open this post.

I have the following scenario:

- The client inserts a domain into the system;
- The account is created in cPanel;
- The system copies some files from another account on the server, and via FTP pastes the files into the /public_html/ folder of the created account.

== I have the error log below, even when the script works 100%. ==

Warning: ftp_login(): Login authentication failed in /home/xxxxxxxx/public_html/central/0000000/controllers/clientes-controller.php on line 10127
There was a problem while creating public_html/integracoes

Warning: ftp_put(): You aren't logged in in <b>/home/xxxxxxxx/public_html/central/0000000/controllers/clientes-controller.php on line 10135
There was a problem while uploading /home/xxxxxxxx/public_html/central/0000000/front/index.php

Warning: ftp_put(): You aren't logged in in <b>/home/xxxxxxxx/public_html/central/0000000/controllers/clientes-controller.php on line 10140
There was a problem while uploading /home/xxxxxxxx/public_html/central/0000000/front/.htaccess

Warning: ftp_put(): You aren't logged in in <b>/home/xxxxxxxx/public_html/central/0000000/controllers/clientes-controller.php on line 10145
There was a problem while uploading /home/xxxxxxxx/public_html/central/0000000/front/integracoes/.htaccess

== This is the line that makes the connection: ==

$login_result = ftp_login($conn_id, $user, $senha);
I have already done several procedures on the server, based on similar problems and could not resolve.

Can anyone help?
 

Infopro

Well-Known Member
May 20, 2003
17,075
525
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
- The system copies some files from another account on the server, and via FTP pastes the files into the /public_html/ folder of the created account.
This sort of thing, copying files to a newly created account, is done using the skeleton directory in the Resellers, or root's cpanel3-skeldirectory. You can read more about that, here:
Skeleton Directory - Version 74 Documentation - cPanel Documentation

I would think that your script does not have permissions to write to another accounts directory structure.
 

Ricardo Lobo

Member
Oct 11, 2016
23
2
3
Brazil
cPanel Access Level
Root Administrator
This sort of thing, copying files to a newly created account, is done using the skeleton directory in the Resellers, or root's cpanel3-skeldirectory. You can read more about that, here:
Skeleton Directory - Version 74 Documentation - cPanel Documentation

I would think that your script does not have permissions to write to another accounts directory structure.
I have a question. If the script does not have the permission, why does it work 100% on some occasions?
 

Ricardo Lobo

Member
Oct 11, 2016
23
2
3
Brazil
cPanel Access Level
Root Administrator
I can't answer that. I can only tell you that you probably shouldn't need a script to do something that's already built into cPanel.
Hi,

I use this function mentioned by you in another dedicated where all clients use the same type of platform and works well.

But in the situation I'm facing with the script, it's different! Not all will receive the files that the script should copy to the / public_html / folder. Understood?

I use this script in another dedicated one and it works perfectly, running 100% without any errors.

Strange, I get an error log even when the script works.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
- The system copies some files from another account on the server, and via FTP pastes the files into the /public_html/ folder of the created account.
Hello @Ricardo Lobo,

Can you share any error messages output to /var/log/messages at the date/time the account is created?

Thank you.
 

Ricardo Lobo

Member
Oct 11, 2016
23
2
3
Brazil
cPanel Access Level
Root Administrator
Hello @Ricardo Lobo,

Can you share any error messages output to /var/log/messages at the date/time the account is created?

Thank you.
Hi,

I have the following log:

Jun 5 11:26:57 host54-73 pure-ftpd: ([email protected]) [INFO] New connection from 111.11.11.11
Jun 5 11:27:03 host54-73 pure-ftpd: ([email protected]) [WARNING] Authentication failed for user [xxxxxxxx]
Jun 5 11:27:03 host54-73 pure-ftpd: ([email protected]) [INFO] Logout.

If I repeat the same function 2 times, it works:

Jun 5 11:26:57 host54-73 pure-ftpd: ([email protected]) [INFO] New connection from 111.11.11.113
Jun 5 11:27:03 host54-73 pure-ftpd: ([email protected]) [WARNING] Authentication failed for user [xxxxxxxx]
Jun 5 11:27:03 host54-73 pure-ftpd: ([email protected]) [INFO] Logout.
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [INFO] New connection from 111.11.11.11
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [INFO] xxxxxxxx is now logged in
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [NOTICE] /home/xxxxxxxx//public_html/index.php uploaded (28533 bytes, 31527.16KB/sec)
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [NOTICE] /home/xxxxxxxx//public_html/.htaccess uploaded (2527 bytes, 12922.09KB/sec)
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [NOTICE] /home/xxxxxxxx//public_html/integracoes/.htaccess uploaded (17 bytes, 115.28KB/sec)
Jun 5 11:27:38 host54-73 pure-ftpd: ([email protected]) [INFO] Logout.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello @Ricardo Lobo,

It's possible that cPHulk is blocking some of the FTP login attempts. Do you notice any output to /usr/local/cpanel/logs/cphulkd.log at the time of the FTP authentication failures?

Thank you.
 

Ricardo Lobo

Member
Oct 11, 2016
23
2
3
Brazil
cPanel Access Level
Root Administrator
Hello @Ricardo Lobo,

It's possible that cPHulk is blocking some of the FTP login attempts. Do you notice any output to /usr/local/cpanel/logs/cphulkd.log at the time of the FTP authentication failures?

Thank you.
Hi,

Looks like it's not registering, see the date!

[2018-07-13 12:26:24 -0300] info [cPhulkd] processor startup with pid 9054
[2018-07-13 12:26:24 -0300] info [cPhulkd] DB processor startup with pid 7706
[2018-07-13 12:37:04 -0300] info [cPhulkd] DB processor shutdown via SIGTERM with pid 7706
[2018-07-13 13:03:29 -0300] info [cPhulkd] processor startup with pid 9054
[2018-07-13 13:03:29 -0300] info [cPhulkd] DB processor startup with pid 8784
[2018-07-13 13:08:40 -0300] info [cPhulkd] processor startup with pid 9054
[2018-07-13 13:11:48 -0300] info [cPhulkd] DB processor shutdown via SIGTERM with pid 8784
[2018-07-13 13:11:48 -0300] info [cPhulkd] processor shutdown via SIGTERM with pid 9054
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello @Ricardo Lobo,

Can you submit a support ticket so we can take a closer look at your system to see if there are any obvious reasons the FTP login attempts are failing? You can post the ticket number here once it's opened and I'll link this thread to it.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello,

To update, here's a summary of the response sent by one of our Technical Analysts:

If you would like these files to be put in every new account, we would recommend using the cPanel skeleton directories as any files here will automatically be placed into newly created accounts. We have some great information on that here:

Skeleton Directory - Version 80 Documentation - cPanel Documentation

Alternatively, an FTP connection wouldn't be necessary for a transfer of files in the same server. Other tools such as the 'cp' (cp(1) - Linux manual page) or 'rsync' (rsync(1) - Linux man page) are better suited to this task, and I would recommend considering updating your script to use one of these methods instead as they would not require the server to make a connection to itself.
Thank you.