Cloud Service >> Knowledgebase >> WordPress >> Verifying WordPress Checksums Using WP-CLI
submit query

Cut Hosting Costs! Submit Query Today!

Verifying WordPress Checksums Using WP-CLI

Verifying WordPress checksums is an important step to ensure the integrity of your WordPress installation. It enables you to hit upon any modified, lacking, or greater core documents that could have been altered with the aid of hackers or plugins. Using WP-CLI, you can quickly and efficaciously affirm your WordPress center documents. Here’s a step-by-step guide on the way to do it:

Step 1: Access Your Server via SSH

1. Log in to Your Server:

- Use an SSH client like Terminal (macOS/Linux) or PuTTY (Windows) to log in to your server.

- Enter your SSH credentials (username, password, or SSH key).

2. Navigate to Your WordPress Directory:

Once logged in, navigate to the directory where your WordPress site is installed. This is typically:
bash
Copy code
cd /path/to/your/wordpress

Step 2: Verify WordPress Core Checksums

1. Run the WP-CLI Command:

Use the following command to verify the checksums of your WordPress core files:
bash
Copy code
wp core verify-checksums

  •  

2. Interpret the Results:

All Files Intact: If all files are intact, WP-CLI will output something like:
plaintext
Copy code
Success: WordPress install verifies against checksums.

Modified Files: If any core files have been modified, WP-CLI will list them and indicate that they don’t match the official checksums:
plaintext
Copy code
Warning: File doesn't verify against checksum: wp-includes/version.php

Missing Files: If any core files are missing, WP-CLI will indicate which files are absent.

3. Optional: Specify WordPress Version or Locale:

If you need to verify checksums for a specific WordPress version or language, you can specify it in the command:
bash
Copy code
wp core verify-checksums --version=6.2 --locale=en_US

Step 3: Take Action Based on the Results

1. If Files Are Intact:

- No further action is required if WP-CLI reports that all files match the checksums.

2. If Files Are Modified:

- Investigate Changes: Review the modified files to determine why they’ve changed. In some cases, legitimate modifications might have been made by plugins or developers.

- Restore Original Files:

If the modifications are unexpected, it’s recommended to restore the original files. You can do this by reinstalling WordPress core files:
bash
Copy code
wp core download --force

- Check for Malware: If you suspect the changes are due to a security breach, scan your site for malware using a security wordpress plugin or service.

4. If Files Are Missing:

- Reinstall Missing Files:

Reinstall the WordPress core to replace missing files:
bash
Copy code
wp core download --force

- This will download the necessary files without overwriting your wp-config.php file or content.

Step 4: Verify Permissions and Security (Optional)

1. Check File Permissions:

Ensure that your WordPress files and directories have the correct permissions to avoid security vulnerabilities:
bash
Copy code
sudo find /path/to/your/wordpress/ -type d -exec chmod 755 {} \;

sudo find /path/to/your/wordpress/ -type f -exec chmod 644 {} \;

2. Update to the Latest WordPress Version:

If you find that your site is running an outdated version of WordPress, consider updating it to the latest version for better security:
bash
Copy code
wp core update

Step 5: Regularly Schedule Checksum Verification

1.Set Up a Cron Job (Optional):

- For ongoing security, you can set up a cron job to automatically verify WordPress checksums at regular intervals. You might need to work with your hosting provider to set this up.

2. Use a Security Plugin:

- Consider using a security plugin that includes file monitoring features, such as Wordfence or Sucuri, which can alert you if any core files are changed.

Step 6: Document Your Findings

1. Record the Results:

Keep a record of any discrepancies found during the checksum verification process and any actions taken to address them.

2. Notify Stakeholders (If Applicable):

If you manage a site for a client or organization, inform them of the results and steps taken to ensure the integrity of the site.

By following those steps, you can successfully confirm the integrity of your WordPress center documents with the use of WP-CLI. Regularly verifying checksums ensures that your web site stays steady and that any unauthorized changes are detected directly.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!