bar1

Member
Oct 11, 2018
14
0
1
SA
cPanel Access Level
DataCenter Provider
Hi ,

I have cpanel running about 20 sites and a list of users , most of them have the same FTP account on all the sites.

Is there a quick why (probably through shell) to quickly change password/add account/delete an account on ALL ftp sites, instead of going 1 by 1?

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello @bar1,

Are these virtual FTP accounts, or are these system accounts (e.g. the cPanel username itself)? For virtual FTP accounts, you can use the following UAPI functions to perform these actions over the command line as root:

UAPI Functions - Ftp::passwd - Developer Documentation - cPanel Documentation
UAPI Functions - Ftp::add_ftp - Developer Documentation - cPanel Documentation
UAPI Functions - Ftp::delete_ftp - Developer Documentation - cPanel Documentation

For example, here's a command you can use to change the FTP password:

Code:
uapi --user=username Ftp passwd user=ftpaccount pass=12345luggage
Granted, you'd still need to run this command for each account, but it's much quicker than using the cPanel UI. Additionally, if your comfortable with developing a custom bash script, you could loop a command like this in a script so that it runs it for all cPanel users.

Thank you.
 

bar1

Member
Oct 11, 2018
14
0
1
SA
cPanel Access Level
DataCenter Provider
ok i am not sure what i am doing wrong....

what is the first user should be?

uapi --user=root Ftp::delete_ftp domin=qa.***.com user=bob


die [uapi] setuids failed: Attempting to setuid as a normal user with RUID 1042 at /usr/local/cpanel/Cpanel/AccessIds/SetUids.pm line 89.
Cpanel::AccessIds::SetUids::_log_and_die_if_not_root() called at /usr/local/cpanel/Cpanel/AccessIds/SetUids.pm line 66
Cpanel::AccessIds::SetUids::setuids("root") called at bin/apitool.pl line 106
bin::apitool::run(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__) called at bin/apitool.pl line 38
die [uapi] setuids failed: Attempting to setuid as a normal user with RUID 1042
exit level [die] [pid=28209] (setuids failed: Attempting to setuid as a normal user with RUID 1042)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello @bar1,

Here's an example command:

Code:
uapi --user=username Ftp delete_ftp user=bob domain=test.tld destroy=1
You need to replace "username" with the username of the cPanel account associated with "test.tld" as opposed to "root", even if you are logged in as the "root" user via SSH.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Is there not a text file i can edit?
Hello @bar1,

Deleting FTP accounts by editing a text file is not supported. The UAPI command noted in my last response is recommended if you want to delete FTP accounts via the command line as it mirrors the actions that occur when deleting FTP accounts via the cPanel user interface.

Thank you.