chmod and chown.
WHAT chmod DOES
Changes permissions.
WHAT THE TWO FORMS ARE
Numeric, setting everything at once Symbolic, adding or removing specific permissions
WHAT SYMBOLIC LOOKS LIKE
A letter for who, a plus or minus, and a letter for what.
WHAT THE LETTERS FOR WHO ARE
u for owner, g for group, o for others, a for all.
WHEN TO PREFER SYMBOLIC
When changing one thing without disturbing the rest.
WHAT chown DOES
Changes the owner, and optionally the group.
WHAT THE FORMAT IS
Owner, a colon, then group.
WHO MAY RUN IT
Root, generally.
WHAT THE RECURSIVE OPTION DOES
Applies to everything beneath a directory.
WHY THAT DESERVES CARE
Running it on the wrong path can make a system unusable.
WHAT TO NEVER DO
Run a recursive ownership change from the root of the file system.
WHAT THE COMMONEST WEB PROBLEM IS
Files owned by root inside a user's account.
WHY IT HAPPENS
Something was extracted or created while logged in as root.
WHAT IT CAUSES
The web server unable to write, and uploads or updates failing.
HOW TO FIX IT
Change ownership back to the account user, recursively, on that account's directory only.
WHAT TO CHECK AFTERWARDS
That the site works, and that permissions were not also wrong.