brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp config shuffle-salts logs everybody out after a break-in

Security
~/tips/tip-wordpress-shuffle-salts

wp config shuffle-salts

Replaces the keys and salts in wp-config.php so every existing WordPress login session becomes invalid.

If you think someone has a stolen session cookie, passwords alone are not the whole story. The salts matter too.

The keys and salts in wp-config.php are mixed into the login cookies. Change them and the old cookies stop being valid. WP-CLI replaces the lot with fresh ones in one command.

wp config shuffle-salts

It fetches new values and rewrites the standard keys and salts in the file. You can name specific keys if you only want some of them refreshed. It does not load WordPress for this, so it works even when the site is broken.

The docs do not describe the effect on users, but it follows from what the salts do: sessions that depend on them end, and people have to log in again. That includes you. Do it after a suspected compromise, after an admin leaves, or when you find a cookie in the wrong hands.

The caveat is the order of work. Shuffling salts does not remove a backdoor or a rogue admin account. So first look for those, for example with wp user list --role=administrator, and change passwords. Then shuffle. Doing it first just logs out the people you actually want.

Further reading: wp config shuffle-salts (WP-CLI command reference), On this site: DISALLOW_FILE_MODS locks plugin and theme changes, not just the editor, On this site: wp plugin verify-checksums –all checks every plugin against WordPress.org

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link