Wednesday, May 20, 2026

Linux command to find user who failed to login from pop/imap

 journalctl -u dovecot -g "auth failed"

grep -i "auth failed" /var/log/mail.log | grep -E "imap|pop"

journalctl -u dovecot -g "auth failed" | grep -oE "user=<.*?>" | sort | uniq -c

grep "auth failed" /var/log/maillog | awk '{print $NF}' | sort | uniq -c | sort -nr



grep "auth failed" /var/log/maillog | grep "@example.com" | head


grep "auth failed" /var/log/maillog | \
grep -oE '[A-Za-z0-9._%+-]+@example\.com' | \
sort | uniq -c | sort -nr

grep "auth failed" /var/log/maillog | \
awk '/@example\.com/ {print $NF}' | \
sort | uniq -c | sort -nr

Monday, August 18, 2025

Wednesday, July 2, 2025

SQL to delete all WooCommerce products except those with "draft" status

 -- Disable foreign key checks (important for InnoDB)

SET

    FOREIGN_KEY_CHECKS = 0;

    -- Delete product meta

DELETE

    pm

FROM

    wp_postmeta pm

JOIN wp_posts p ON

    pm.post_id = p.ID

WHERE

    p.post_type = 'product' AND p.post_status != 'draft';

    -- Delete term relationships

DELETE

    tr

FROM

    wp_term_relationships tr

JOIN wp_posts p ON

    tr.object_id = p.ID

WHERE

    p.post_type = 'product' AND p.post_status != 'draft';

    -- Delete the products

DELETE

FROM

    wp_posts

WHERE

    post_type = 'product' AND post_status != 'draft';

    -- Enable foreign key checks again

SET

    FOREIGN_KEY_CHECKS = 1;

Thursday, June 26, 2025

Restrict Access to PHPMyAdmin with DirectAdmin

cd /usr/local/directadmin/
./directadmin set one_click_pma_login 1 restart
cd custombuild
./build update
./build set phpmyadmin_public no
./build phpmyadmin

Wednesday, June 18, 2025

How not to fill filtered out cells when dragging down from another sheet

Steps:

  1. Apply your filter in Sheet1.

  2. Select the range where you want to paste the formula (e.g., A2:A100) but only visible cells will be selected.

    • Select the range.

    • Press F5 or Ctrl+G → Click Special… → Choose Visible cells only → OK.

  3. Type your formula (e.g.):

    =INDEX(Sheet2!A:A, ROW()-1)
  4. Press Ctrl+Enter (instead of just Enter).

Saturday, May 3, 2025

Resetting the DirectAdmin Password via SSH:

 Resetting the Password via SSH:

  1. Access the server as root: Use an SSH program like PuTTY to connect to your server as the root user. 
  2. Reset the password: Execute the command passwd <username> (replace <username> with your DirectAdmin username, often admin or your server username). 
  3. Follow the prompts: You'll be prompted to enter a new password twice. 
  4. Verify the change: Once successful, you'll see a message confirming the password change. 
  5. Restart DirectAdmin (optional): You may need to restart the DirectAdmin service using the command service directadmin restart. 

Sunday, April 20, 2025

Reset WordPress Admin Password via MySQL Command Line


mysql -umyUserName -paVeryStrongPassword

show databases;
 
use myWordpressDB;

SELECT ID, user_login, user_pass FROM wp_users;

UPDATE wp_users SET user_pass=MD5('YourNewStrongPassword') WHERE ID = 1;

SELECT ID, user_login, user_pass FROM wp_users;

Linux command to find user who failed to login from pop/imap

 journalctl -u dovecot -g "auth failed" grep -i "auth failed" /var/log/mail.log | grep -E "imap|pop" journalct...