File Management
Posted 04th Oktober, 2018
cPanel has an advanced folder structure, which can be accessed through the File Manager, an FTP client like Filezilla, or SSH.
Structure Explanation
A cpanel primary domain runs from the public_html folder, so your default index.html or index.php file will run from this location. However there are numerous other folders, and you can place your website files outside of the public_html folder.
The full path to your home directory is /home/username and the full path to your public_html folder is therefore /home/username/public_html.
Here, we will explain the purpose of all folders and files under /home/username:
- access-logs - This is a symlink to /usr/local/apache/domlogs/cscfweb, where are stored access logs for this account.
- .bash_logout, .bash_profile & .bashrc - Three files in your home directory have a special meaning to bash, providing a way for you to set up your account environment automatically when you log in and when you invoke another bash shell, and allowing you to perform commands when you log out.
- .cpanel - This is the folder, where all cPanel settings are stored(theme and etc.)
- cpmove-abcdefgh.tar.gz - This is a full cPanel backup of the account.
- etc - In this folder are stored files, which contains the whole information for the user - encrypted passwords, homefolder,username, real name, quotas and etc.
- .ftpquota - The .ftpquota file logs the maximum number and size of the uploded files in a single transfer.
- logs - An archive of Apache access logs for your domain.
- mail - Here are stored all emails to local email accounts on your domains.
- mysql_backups - Here are stored generated MySQL backups.
- public_ftp - This folder is not often used except for instances where you need a space to allow FTP users to upload files that aren't immediately public.
- public_html - This folder is the main folder for your domain that is accessible to the web. Files uploaded to this folder will be visible on your main cPanel domain.
- ssl - This is folder, where installed SSL can be stored.
- tmp - Temporary files and sessions are stored here.
- www - This is a symlink to public_html folder.
Permissions and Ownership
The default permissions on cPanel are 755 for folders and 644 for files.
All files and directories on Linux computers have access permissions that tell the operating system how to handle access requests. There are three basic access permissions:
- Read: Files with read access enabled can be viewed by the user. The read permission is represented by the letter r or the number 4.
- Write: Files with write access enabled can be modified by the user. The write permission is represented by the letter w or the number 2.
- Execute: Files with execute access enabled can be run as programs by the user, and directories with execute access enabled can be accessed by the user. The execute permission is represented by the letter x or the number 1.
If you use 7, you will give all of the above permissions (rwx) - Read,Write,Execute.If you use 6, you will give (rw) - Read,Write permissions.
Changing Permissions
Permissions can be changed either in the cPanel file manager, through an FTP client (by right clicking Edit Permissions
), or via SSH as follows:
chmod 644 file
Changing Ownership
These three access permissions are then set for three types of user groups:
- User: The owner of the file.
- Group: Other users who are in the same group as the group to which the file belongs.
- World: This access type is for everyone else; that is, those who are not the user or who are not in the same group.
The first number in the permissions is for user, the second one for group and the last one is for world.For example, if the permissions are 644, the file will be readable&writable by user and readable by group and world.
The owner and group can be changed with the following command:
chown username:group file
The File Manager is one of the essential tools used in the control panel. It gives full access to all files associated with your hosting (website, email, logs, configuration files etc). It can be found under the Files section in your control panel.
The File Manager gives access to your files in the same way that FTP or ssh would. For bulk operations or advanced users we recommend connecting via FTP using a desktop client such as Filezilla.