Default Home Directory Folders

For web developers and administrators, the relocation and removal of files/folders is a task that likely occurs on a daily basis and can also be the cause of multiple website issues. The following list is intended to dictate the default folders inside of the home directory that should not be altered. The removal, misplacement or relocation of these files and folders can result in multiple issues, including but not limited to 404 errors, disruption of email or a misbehaving control panel.

When managing files on the server, it is always recommended that you create a full directory backup prior and save it to your computer.

You will also want to read:

CPanel Security
CPanel Login Tutorial
CPanel Account Information Tutorial
Backup mysql database tutorial
I have a full backup of account through cPanel. How do I restore it?

cPanel Folders

The folders below are listed in the cPanel home directory by default:

/home/username/public_html
/home/username/public_ftp
/home/username/etc/
/home/username/mail/
/home/username/.cpanel
/home/username/.sqmaildata
/home/username/.cpanel3-skel
/home/username/.trash
/home/username/.sqmailattach
/home/username/.fantasticodata
/home/username/.htpasswds
/home/username/.access-logs
/home/username/.tmp

Also read:
Cannot See My Website Online After Upload, Why?
Character encoding in cPanel file manager
Custom error page is not working
How To Create, Edit, and Delete a File in CPanel Using File Manager
Getting Familiar With the cPanel User Environment

Now let us make a basic explanation:

Your website files will be kept in the public_html folder. You do not just load files into this folder because whatever you place here is available to the general public except you place some restrictions and set file permissions which does not allow general access.

Please note that unlike when you are using your computer to save documents or files, whatever file or folder you delete on your website will not be recoverable.

Deleting some files or folders can completely destroy the functionality of your website. The only way you may be able to restore your website back is to re-upload the file or folder you deleted from another source or you simply do a total website restore from a backup.

Remember, you ca always contact customer support if you face a difficult challenge and need any external help.

Also read:

How Do I Create and Delete a Parked Domain
How do I create and remove an Addon Domain?
How to Backup My Website in cPanel
How to Create a MySQL Database, a User and Delete Database in Cpanel

Plesk Folders

The folders below are listed in the Plesk home directory by default:

/var/www/vhosts/domain.com/httpdocs
/var/www/vhosts/domain.com/anon_ftp
/var/www/vhosts/domain.com/cgi-bin
/var/www/vhosts/domain.com/error_logs
/var/www/vhosts/domain.com/httpsdocs
/var/www/vhosts/domain.com/private
/var/www/vhosts/domain.com/statistics
/var/www/vhosts/domain.com/subdomains
/var/www/vhosts/domain.com/vault_scripts
/var/www/vhosts/domain.com/web_users
/var/www/vhosts/domain.com/.Security


What is root directory and how should the permissions be set?


The public_html folder is the web root for your primary domain name. This means that public_html is the folder where you put all website files which you want to appear when someone types your main domain (the one you provided when you signed up for hosting).

Or put another way, when someone types your domain name into their browser, whatever is in the public_html folder is what will be shown to them.

For example, if you have a file called index.html (or any of the other default filenames) in the public_html folder, it will display that page.


If you do no have a default file in the public_html folder (such as index.html, default.html, etc.), then a list of files in the public_html folder will be shown.
Path in File Manager (or in FTP)* Corresponding URL in a Web Browser
/public_html/ http://www.yourdomain.com/
/public_html/pagename.html http://www.yourdomain.com/pagename.html
/public_html/folder/ http://www.yourdomain.com/folder/
/public_html/folder/page.html http://www.yourdomain.com/folder/page.html

Replace yourdomain.com with the primary domain on your account (the one you originally signed up with, unless you changed it).
Addon Domains & Subdomains

You can also create Addon domains and Subdomains, and these will use a folder inside public_html.


Addon Domain and Subdomain Examples.

You can create an Addon domain called addondomain.com and it will use a subfolder similar to /public_html/addondomain.com/ (unless you specified otherwise).

Or you could create a Subdomain called host.yourdomain.com and it would use a subfolder similar to /public_html/host/ (unless you specified otherwise).

If host.yourdomain.com is defined as a subdomain, and addondomain.com is defined as an addon domain, then the following examples apply:
Path in File Manager (or in FTP)* Corresponding URL in a Web Browser
/public_html/tod/ http://tod.yourdomain.com/
/public_html/addondomain.com/



Replace yourdomain.com with the primary domain on your account (the one you originally signed up with, unless you changed it). Replace addondomain.com with the additional domain you added in the "addon domains" section of cPanel.
If you do not want additional domains to be subfolders of public_html, then reseller, VPS or dedicated hosting is a better solution, since you can put each domain in its own cPanel to keep it separate from other domains. Shared accounts only get one cPanel, which is why all addon domains are subfolders of the public_html folder.


Permissions

The public_html folder should always have 0750 permissions.

All folders inside the public_html folder should have 0755 permissions.

All files inside the public_html folder should have 0755 or 0644 permissions.

Some websites and scripts may advise you to use 777 permissions, however, our servers are configured to use 755 for the same purpose instead, since it is more secure. Permissions of 777 on any file or folder will cause the file to be inaccessible. Use 755 instead of 777.

*The full path is actually /home/username/public_html/ (where username is your cPanel username) rather than /public_html/ but in most places you will see /public_html/ instead of the full path, since it assumes you know you are in your own home directory.


My Public_Html Folder is Suddenly Empty

There can be several reasons for why your files seem to have suddenly disappeared.

Deleted manually

It is possible someone logged in to File Manager and deleted or moved the files. Check you other folders and check outside of public_html.

FTP access used

If you gave FTP access to someone, they do have the power to delete files. They may have accidentally downloaded the files without leaving a copy, although it is not an easy mistake to make.

To prevent this, you can create them a FTP account which only has access to a subfolder in public_html. (See How to create an FTP account in cPanel, step 9.) This will allow them the access they need, while barring them from seeing and changing anything in your public_html folder.

Unfortunately, you cannot give someone access to a directory, but then prevent them from deleting the files there.

Accessing the wrong account

This mistake is much more common than you think. Be sure you are using your cPanel user name, and not "root". This especially applies to those using SSH access.

How to Change the Default Home Directory in cPanel

You can change the default home directory only if you are able to have access to WHM. Follow this steps to do so.

1) Go to Server Configuration, then Basic cPanel/WHM Setup.

2) Scroll down.

By default, all directories matching the Home Directory Prefix option are checked for available disk space; the directory with the most free space will be used. Unless you have a good reason, this is probably the most desired functionality. If you use the default prefix of "home" and create a /home and /home2 directory on your web server, new accounts will be placed in either /home or /home2, according to which directory contains the smallest amount of information.

If you want to force WHM to use the Default Home Directory specified, you must disable the prefix option by putting a blank value in that field.

3) Change to the desired directory name.

4) Click Save.

Restore home directory backup in cPanel

You should now know how to restore your website files from a partial home directory backup in cPanel that you've previously made.

Now, let us loo at how to restore a partial home directory backup in cPanel. This will allow you to restore your account's website and email files to a previous date when you last made a website backup.

This is good knowledge to have, so in case you've accidentally removed some files from your website, or deleted an important email, you can get those lost files back. It's also handy to backup website files prior to upgrading software that runs your website, so that if anything goes wrong you can at least revert to the working old version again.

When you restore a partial home directory backup like we're creating covering below, this is going to overwrite any existing files currently on your account. So if you have a /public_html/index.htm file on your account, and the backup you created also has that file, the file from the backup will be restored over the current live file.

If you have a new file such as /public_html/index2.htm live on your website that didn't exist in the backup, or you've gotten new emails since you made your partial home directory backup, these files will not be overwritten during the restore.
Restore home directory backup in cPanel

Following the steps below you can restore a partial backup of your website including all the files in your home directory.

Login to your cPanel.
Click on backup icon in cPanelUnder the files section, click on Backup.
Select file being restoredClick on Choose File.
cPanel backup progressThe name of your backup should now be displayed, so click on Upload.
cpanel backups home directory restore completed You should then see the progress of your files being restored.

You should now know how to restore your website files from a partial home directory backup in cPanel that you've previously made.

  • 54 Users Found This Useful
Was this answer helpful?

Related Articles

I have a full backup of account through cPanel. How do I restore it?

It is recommended that you maintain healthy backup of your website and possibly download the...

How To Create, Edit, and Delete a File in cPanel Using File Manager

This tutorial will be useful for you to understand how to create a file, edit a file or delete...

How to Create and Manage a MySQL Database

Create MySQL Database and User via cPanel The MySQL Database Wizard is another useful tool...

How do I create and remove an Addon Domain?

An add-on domain is a separate domain name that you add to your web hosting subscription with...

How to Set Up and Delete a Cron Job

A cron job allows you to run a certain command at times set by the job. For example, you could...

Powered by WHMCompleteSolution