Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

12 October 2026 · One command a day

How do I find world-writable files on my Linux web server?

This command lists every file under your web root that any user on the server is allowed to change. Files like that let an attacker who gets a foothold through a weak plugin or a compromised account plant code in your sites. Run it after you set up a new site, after a deploy, and whenever something looks wrong.

I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.

The command

sudo find /var/www -type f -perm -o+w

sudo lets find read every folder, including ones your normal user cannot open. find /var/www starts in your web root and works down through every subfolder. -type f limits the results to regular files, so folders and symlinks are skipped. -perm -o+w matches files where the "others" write bit is set. The minus sign before o+w means "at least this bit is set", so files with mode 666, 777 or 646 all match.

What you will see

/var/www/example.com/public/uploads/report.pdf
/var/www/example.com/public/config.php
/var/www/sitename/storage/logs/app.log
/var/www/sitename/index.html

Each line is one file that anyone on the server can write to. If nothing prints, nothing matched and you have no world-writable files under that path. Look hardest at anything the web server executes or serves, such as .php, .js and .html files, and at configuration files. A writable config.php is far more dangerous than a writable PDF. To fix a file, remove the write bit for others with sudo chmod o-w followed by the path, and check who owns it.

When to use it

Watch out for

This command only checks files. A world-writable folder is often worse, because anyone can add new files to it or delete and replace existing ones, even if the files themselves look locked down. Run the same search with -type d in place of -type f to find those folders too. Upload and cache folders are the usual offenders. They need to be writable by the user your web app runs as, not by everyone, so fix them by setting the right owner and group rather than leaving them open to all.

Questions people ask

Can I fix every match in one go?

Yes, sudo find /var/www -type f -perm -o+w -exec chmod o-w {} + removes the write bit for others on every match. Read the list first so you know what you are changing.

Will removing world-write break my site?

Usually not, as long as the app's own user owns the files it needs to write. If something breaks, fix the owner with chown rather than reopening the file to everyone, the same way you would lock down a .env file.

Checking permissions across the whole web root is something you can only do on a server you control, not on shared hosting. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

Related server notes: How do I search inside files for text on Linux? · How do I fix file ownership on Linux after running something as root? · How do I see which process is using a port on Linux? · All daily notes