Categories: LinuxUbuntu

BULK LINUX CHMOD COMMANDS FOR FILES & DIRECTORIES

Recently in Ubuntu which I use for my hosting operating system of choice I needed to bulk change permissions on a bunch of folders and files. I needed to set permissions on folders within a WordPress installation to 755 and all files in theme, plugin and asset directories to 644.

While my command line-fu is not very strong, I was able to work it out and I thought I would share my findings here for others.

Advertisement

To bulk change permissions on folders:

find /yourlocationwithfolders -type d -exec chmod 755 {} \;

To bulk change permissions on files:

find /yourlocationwithfolders -type f -exec chmod 644 {} \;

You can use the -R recursive flag with chmod, but it will not allow you to set permissions on all folders and files, but rather on everything (which is rare you would want to set permissions on everything to be the same).

Advertisement

Recent Posts

Securing phpMyAdmin Like a Pro: Essential Tips and Tricks

Securing phpMyAdmin is crucial to prevent unauthorized access and protect your databases. Here's a guide…

5 months ago

Pasqal raises $100M to build a neutral atom-based quantum computer

Pasqal, a Paris-based quantum computing startup, today announced that it has raised a $100 million…

1 year ago

Apple in talks with Disney, others on VR content for new headset: Report

Developed with Sony Group Corp, the headset will have two ultra-high-resolution displays to handle the…

1 year ago

Microsoft, Amazon results to highlight softening cloud business

After years of blistering growth, most recently fuelled by remote working and studying during the…

1 year ago

Intel chairman Omar Ishrak steps down

Omar Ishrak had stepped down and the chipmaker appointed board director Frank Yeary as his…

1 year ago

Canada to commercialise world's first photonic-based quantum computer

Canadian Prime Minister Justin Trudeau has announced a new federal investment to build and commercialise…

1 year ago