cPanel & WHM Version 92 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Prevent FTP Account Manager "Delete Account" from Deleting Core Web Files

Tcalp shared this idea 5 years ago
Open Discussion

Summary:


When deleting an FTP account it is also possible to delete the home directory assigned to the FTP account. The user should be informed when this directory is the same as a website document root. Ideally the user should be prevented from removing the directory, and its contents, when it is the document root.


Original request:

Hi Guys,


While I get that this is only an option provided to users when deleting account, users aren't always the most tech savvy bunch ... when an account root is pointed to say "public_html", it will proceed to wipe out all files in public_html. Some level of "tool rights" logic should be added here, maybe to say if it's associated with an active add-on domain or core folders like "public_html" that the files cannot be removed from said tool.


We are a very small hosting company compared to most and we see this happen at least once a month to one of our users which means us digging out a back-up and doing a partial restore, thus eating valuable staff time.


Please code in some additional common sense to prevent user stupidity :).

Best Answer
photo

In X3 the user can easily delete everything with a single button click. For Paper Lantern we changed this to require an additional opt-in to remove the directory and its contents. As the conversation here shows there is still room for improvement.


Informing the user of additional consequences of removing the directory will help in deciding whether to take that action.

Comments (12)

photo
1

In X3 the user can easily delete everything with a single button click. For Paper Lantern we changed this to require an additional opt-in to remove the directory and its contents. As the conversation here shows there is still room for improvement.


Informing the user of additional consequences of removing the directory will help in deciding whether to take that action.

photo
1

@Kenneth, I wouldn't really call a prompt protection.


Case scenario:

As a cPanel user, I create a new FTP account for a developer, pointing it to the public_html folder. The developer does his work, and as the account is no longer required, I go into "FTP Accounts", and remove the account. As I am not horribly tech savvy, I choose the option to delete the account and associated files. This will delete the public_html folder and all sub-folders/contents.


What I am suggesting here is that this is a horrible thing that the software allows for. Just like if I attempt to delete a sub-domain that is associated with an add-on domain, it will produce an error. A similar set of rights should be added here, namely checking the folder paths for any add-on domain / sub-domain / parked domain / (etc) , along with the base public_html folder path, if any of these match up to what is going to be deleted, don't do it.


If this is still unclear please let me know.

photo
1

Tcalp wrote:

@Kenneth, I wouldn't really call a prompt protection.


Case scenario:

As a cPanel user, I create a new FTP account for a developer, pointing it to the public_html folder. The developer does his work, and as the account is no longer required, I go into "FTP Accounts", and remove the account. As I am not horribly tech savvy, I choose the option to delete the account and associated files. This will delete the public_html folder and all sub-folders/contents.


What I am suggesting here is that this is a horrible thing that the software allows for. Just like if I attempt to delete a sub-domain that is associated with an add-on domain, it will produce an error. A similar set of rights should be added here, namely checking the folder paths for any add-on domain / sub-domain / parked domain / (etc) , along with the base public_html folder path, if any of these match up to what is going to be deleted, don't do it.


If this is still unclear please let me know.

Would something like what is shown in the attached image help?

photo
1

Hi Kenneth,


See attached image, that would be the ideal situation.

photo
1

A better message may be "This folder cannot be removed via this tool as it's in use by domain.com."

photo
1

Tcalp wrote:

A better message may be "This folder cannot be removed via this tool as it's in use by domain.com."
Thank you for that mockup. How would you account for the people that intend to delete both the account and files when deleting the FTP account?

photo
1

Please describe a scenario where a user would want to actually do this ?

photo
1

Tcalp wrote:

Please describe a scenario where a user would want to actually do this ?
A scenario where a user is completely done with a domain (i.e. no longer wants or needs it).

photo
1

Kenneth,


I suppose that can/will certainly happen, but I don't see any reason why the FTP account tool needs to assist in removing these files. That said, if the user has already removed the site from the add-on/sub-domains/etc then there would be no block present on the FTP tool from deleting the directory.


All that said, per your case scenario, it would be far better to present a delete option to that end within the removal of the sub-domain / add-on domain and not via the FTP accounts manager.

photo
1

Equally, imagine a situation where you have the following deployment scenario:


domain.com public_html (main cPanel account)

sub.domain.com public_html/sub (sub-domain of main account)

myname.com public_html/myname.com (add-on domain)

thisname.com public_html/thisname.com (add-on domain)


You have an FTP account that is pointed to 'public_html' , delete it with the checkbox / remove files. It will wipe out all websites.


This option simply has too much power for non-tech savvy users.

photo
1

Tcalp wrote:

Equally, imagine a situation where you have the following deployment scenario:


domain.com public_html (main cPanel account)

sub.domain.com public_html/sub (sub-domain of main account)

myname.com public_html/myname.com (add-on domain)

thisname.com public_html/thisname.com (add-on domain)


You have an FTP account that is pointed to 'public_html' , delete it with the checkbox / remove files. It will wipe out all websites.


This option simply has too much power for non-tech savvy users.

Hello, I updated the request with a summary of our conversation, as well as the Official Response (due to limitations of this feature request system I'm not able to remove the official response).


Thanks for the input!

photo
1

Perhaps limit cpanel FTP management to paths it actually created. That way only WHM could terminate account or intentionally delete /public_html or paths not created by cP.