Server security guide · Romania

How do I secure a cPanel account on shared hosting?

On shared hosting you do not administer the server, but you administer everything that matters to your site: passwords, files, databases, mailboxes and PHP. Most compromised cPanel accounts fall to reused passwords, plain FTP and old sites forgotten on a subdomain.

Updated:

Short answer

  1. Turn on two-factor authentication for the cPanel account and use long, different passwords for cPanel, each FTP account, each database and each mailbox.
  2. Replace FTP with SFTP or the panel's File Manager, so that passwords do not travel in clear text.
  3. Keep permissions at 755 on directories and 644 on files, disable dangerous PHP functions and expose_php in php.ini, and leave ModSecurity enabled.
  4. Delete the sites, subdomains and FTP accounts you no longer use, and add a periodically downloaded local copy to the provider's daily backup.
First step
2FA on the cPanel account, a unique password
File transfer
SFTP on port 22 or the File Manager, never plain FTP
Permissions
directories 755, files 644, never 777
php.ini
expose_php = Off, disable_functions with exec, system, shell_exec

What you control on shared hosting and what your provider controls

Your provider normally looks after the operating system, server updates, isolation between accounts, the firewall and ModSecurity. You are responsible for everything inside your account: passwords, files, applications, databases and email. An outdated WordPress, an old FTP password or a test script forgotten on a subdomain are your problems, and the consequence is that the whole account falls, not only the affected site: a PHP file uploaded into an old site can read the files of every site in the same account, including the main site's wp-config.php.

Measures in order of impact

Start with access: 2FA on cPanel, a unique password from a password manager, and a review of FTP accounts and database users, deleting what you do not recognise. Move to SFTP, because FTP sends the password in clear text and on a public network it is the first password stolen. Then files: 755 and 644 permissions, never 777. In php.ini disable exec, system, shell_exec, passthru and proc_open, set expose_php to Off and run a supported PHP version. Give each mailbox its own password, because one cracked mailbox sends spam and puts your domain on blocklists.

  • A separate FTP account, limited to one directory, for each collaborator and deleted when the job ends
  • Test subdomains and old sites are deleted, not left 'just in case'
  • Malware scanning if the provider offers it, and a copy of the backup downloaded to your own machine every month

What Romanian law expects

Shared hosting does not exempt you from GDPR: forms, customer accounts and the shop process personal data under your responsibility, and Article 32 requires adequate measures. The provider is your processor under the data processing agreement, but a weak FTP password and an outdated WordPress are your measures. After a breach, notifying ANSPDCP within 72 hours is your company's duty, not the provider's. Invoices issued through e-Factura must be retained, so a backup of the account, database included, also has a tax basis.

Security settings in cPanel and where to find them
SettingWhere in cPanelRecommended valueWhat it prevents
Two-factor authenticationSecurity → Two-Factor AuthenticationOn, TOTP codeAccount takeover with a stolen password
FTP accountsFiles → FTP AccountsOnly those needed, limited to one directory; use SFTPClear-text passwords, access to the whole account
File permissionsFile Manager755 for directories, 644 for filesWrites by injected scripts
PHP settingsSoftware → MultiPHP INI EditorSupported version, expose_php Off, disable_functionsCommand execution from injected scripts
ModSecuritySecurity → ModSecurityActive on all domainsSQL injection, XSS, malicious uploads
BackupFiles → BackupProvider's daily backup plus a monthly local downloadData loss, ransomware
Remote MySQL accessDatabases → Remote MySQLEmpty, or exact IP addresses onlyBrute force against the database

Commands and configuration

php.ini (or MultiPHP INI Editor): no shell functions, no exposed version
expose_php = Off
display_errors = Off
log_errors = On
allow_url_include = Off
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec
Correct permissions from Terminal (if enabled) or over SFTP
find ~/public_html -type d -exec chmod 755 {} \;
find ~/public_html -type f -exec chmod 644 {} \;
chmod 600 ~/public_html/wp-config.php

Practical examples

Tourism agency in Iasi with three sites in one account

An old campaign site on a subdomain, forgotten for two years, was broken through an outdated plugin. The intruder then read the main site's wp-config.php from the same account and injected redirects to gambling pages. Deleting the subdomain and changing every password came before restoring from backup.

Accounting practice in Cluj-Napoca with email on cPanel

A mailbox whose password matched the cPanel password was compromised and sent thousands of phishing messages overnight. The domain landed on blocklists and customers stopped receiving invoices. Unique passwords per mailbox, 2FA and the sending limit in the panel fixed it.

Common mistakes

  • Using the same password for cPanel, FTP, the database and the main mailbox.
  • Connecting over plain FTP, in clear text, from public networks.
  • Setting 777 on directories to make an upload work, and leaving it that way.
  • Keeping old, unpatched sites and subdomains in the same account as the main site.
  • Relying only on the provider's backup and having no copy of your own.

How 4hosting helps

  • cPanel plans include a Let's Encrypt certificate, a daily backup and email, which covers encryption in transit and basic recovery; the account hardening in this guide is still yours to apply.
  • From cPanel Advanced up you get 1 h a month of included services. Request it from the DevOps Services section of the client panel, for example for a review of FTP accounts and PHP settings. The hour is not carried over to the next month, and extra hours are accepted and billed separately.
  • WAF & DDoS Protection adds OWASP rules and bot filtering in front of your sites, on top of the L3/L4 DDoS protection included at network level.

Related questions

  • On shared hosting, can other accounts on the same server read my files?

    Not if the provider isolates accounts properly, which is standard on modern cPanel. The real risk is inside your own account: all your sites share one user, so one compromised site exposes all of them. That is why old sites get deleted and important ones live in separate accounts.

  • Do I need a security plugin if the hosting has ModSecurity?

    ModSecurity filters requests at server level, before PHP, and covers general attack patterns. It does not replace application updates, 2FA on the application's own admin panel or login attempt limits, which sit at application level. One plugin for those, plus ModSecurity, is enough.

  • How often should I download a local backup?

    Monthly for a brochure site, weekly for a shop, and always before a major change. The local copy protects you in the scenario where the account is deleted, suspended or encrypted together with the backups kept on the server.

Request a security review

A production server starts getting attacked within minutes of receiving a public IP address, however small the project is. This guide ranks the controls by impact, from SSH access to incident response, with the Romanian rules that apply along the way. Every topic has its own page with a short answer, examples and ready-to-use configuration.