Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use chmod to change read, write, and execute permissions; chown to change a file’s user owner and optionally its group; and chgrp to change only the group. These are separate controls, so a Permission denied error can require an ownership fix, a permission fix, or both. Check the current state first, make the smallest change that solves the problem, and use recursive options only when you have verified the path.

How Linux permissions and ownership work

Every filesystem object has permission bits for three classes: the owner user, the owner group, and everyone else (often called others). Each class can have read (r), write (w), and execute (x) permission. The owner and group are separate metadata fields. Changing one does not automatically change the other.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a regular file, read permits opening its contents, write permits modifying or truncating it, and execute permits running it as a program. A directory uses the bits differently: read allows listing names, write allows creating or removing entries, and execute allows traversing the directory and accessing entries when the rest of the path also permits it. A directory that is readable but not executable can still produce access errors.

Inspect a path before changing it:

ls -l /path/to/file
id
stat /path/to/file

The first field from ls -l shows the permission bits, followed by the owning user and group. id shows your user ID and group memberships, which matters when you are trying to use a group you do not belong to.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

chmod, chown, and chgrp compared

Command Changes Typical form Who can use it
chmod Read, write, and execute permission bits chmod 644 file The owner or a privileged administrator can change mode bits
chown User owner, and optionally group chown user:group file Only root can change a file’s owner; changing the group is restricted to groups you are allowed to use
chgrp Group owner only chgrp group file A user can select a group they belong to; root can select other groups

Use chmod when the correct user and group already own the path but access is too broad or too narrow. Use chown when a service, account, or project needs a different owner. Use chgrp when the user owner should remain unchanged and only the collaborating group needs to change.

Change permissions with chmod

Numeric (octal) mode

A numeric mode supplies one digit for the owner, group, and others, in that order. Read is represented by 4, write by 2, and execute by 1; add the values you want for each class. Thus, 6 means read plus write, 4 means read only, and 5 means read plus execute.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chmod 644 report.txt
chmod 600 secrets.env
chmod 755 deploy.sh

644 gives the owner read/write and everyone else read-only access. 600 restricts a file to its owner. 755 makes the owner able to read, write, and execute while group and others can read and execute. Select modes according to the file’s purpose; do not use a convenient number without considering who should be able to modify it.

Symbolic mode

Symbolic mode identifies the class and operation explicitly. The class letters are u (user owner), g (group), o (others), and a (all three). The operators are + to add, - to remove, and = to set exactly the listed permissions.

chmod u+x script.sh
chmod go-w shared.txt
chmod a=r,u+w notes.txt
chmod u=rw,g=r,o= file.txt

Multiple comma-separated clauses let you make a targeted change without rewriting unrelated bits. For example, chmod a=r,u+w notes.txt gives everyone read permission and then adds owner write permission, resulting in owner read/write and group/others read.

Recursive changes without making every file executable

-R applies a command below a directory. A blanket chmod -R 755 directory gives execute permission to regular documents, scripts, images, and data files alike. That is usually unnecessary and can create a security or operational problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

For a tree in which directories should be traversable and existing executable files should retain execution, use the GNU manual’s pattern:

chmod -R a=,+rwX project/

The capital X adds execute permission only to directories and to files that already have an execute bit. Review the result with find or repeated ls -l before exposing the tree to other users or services.

Change the owner or group with chown

Set a user owner

sudo chown alice report.txt

The command changes the user owner and leaves the group as it was. Changing a file’s owner is a privileged operation: only root can do it. On systems where you administer through sudo, put sudo before the command and confirm the path carefully.

Set both user and group

sudo chown alice:developers report.txt

This sets the user owner to alice and the group owner to developers. Naming both fields is the clearest choice for deployments because it avoids depending on a user’s default login group.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change only the group with chown

sudo chown :developers report.txt

A leading colon with no user changes only the group, similar to chgrp developers report.txt. A user followed by a colon and no group has a different meaning on GNU systems: it sets the user owner and sets the group to that owner’s login group. If you need predictable cross-system behavior, specify the group explicitly.

Change only the group with chgrp

chgrp is useful when ownership by the current service account or individual must remain intact. Basic usage is:

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
chgrp developers report.txt
sudo chgrp -R developers project/

Non-root users can change a file’s group only to a group they belong to. The GNU form also supports a reference file:

chgrp --reference=template.txt new.txt

This copies the group ownership from template.txt to new.txt. Check the resulting group with ls -l; a successful command can still leave an application unable to access the file if directory traversal or permission bits are wrong.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recursive operations and symbolic links

Recursive ownership changes are powerful and easy to over-apply. Before running chown -R, chgrp -R, or chmod -R, verify the directory with pwd, list its immediate contents, and use an absolute path when practical. A typo in a recursive path can alter a much larger tree than intended.

Symbolic links need special care. By default, chown changes the link’s target. To change the ownership of the symbolic-link object itself, use -h:

sudo chown -h alice:developers current

For chgrp, the manual documents -R, -H, and --no-dereference. Use --no-dereference when the group change must apply to the link itself rather than the object it points to:

sudo chgrp --no-dereference developers current

Decide first whether the application follows the link or needs the link metadata changed. A link-only change does not repair permissions on its target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Shared directories: SGID and ACLs

Keep a shared group on new files

For a team directory, set the directory’s group and the SGID bit so newly created entries inherit the directory’s group:

sudo chown root:developers /srv/teamwork
sudo chmod 2775 /srv/teamwork

The leading 2 sets SGID on the directory; 775 gives the owner and group read/write/execute and gives others read/execute. The exact mode should match your policy. SGID helps maintain group ownership, but it does not by itself grant group write permission if the mode does not include it.

Grant access to named users with ACLs

Owner/group/other bits provide only three access classes. When one or more individual users need additional access without changing the primary owner or broadening access for everyone, use POSIX ACL tools:

setfacl -m u:alice:rwx /srv/teamwork
getfacl /srv/teamwork

Default ACLs can define permissions inherited by new entries in a shared project. ACLs add another layer to diagnose: inspect them with getfacl after checking ordinary mode bits and ownership.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ubuntu 25.10 and newer: verify which chown you are running

Ubuntu 25.10 and newer ship the Rust-based uutils implementation of chown by default. A tutorial testing Ubuntu 26.04 reported that chown USER: changed the owner but left the group unchanged, unlike the GNU behavior described above. This was a single-system report, so verify your release and implementation rather than assuming the result.

When both fields matter, avoid the ambiguous shorthand and name the group:

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
sudo chown USER:GROUP file

The GNU implementation remains available as gnuchown on the cited Ubuntu setup. Check your command’s documentation and test on a noncritical file before scripting behavior that depends on an omitted group.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose “Permission denied” methodically

1. Confirm the path and every directory in it

Read and write permission on the final file are not enough if a parent directory cannot be traversed. Check each directory component, especially when a service uses a home directory, mounted volume, or deployment path.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Check user, group, and mode together

ls -ld /path /path/to /path/to/file
id serviceuser
stat /path/to/file

Compare the process user and its supplementary groups with the file’s owner and group. A file can show a seemingly permissive mode while still being inaccessible because a parent directory lacks execute permission or because the process is running as a different account.

3. Fix ownership before widening permissions

In web-server and container deployments, wrong ownership is frequently the underlying cause. If a service should own generated files, assign the correct service account and group with chown or chgrp, then set the narrowest mode that permits the required operation. Avoid solving an ownership mistake with world-writable permissions.

4. Account for symlinks and mounts

If the path is a symbolic link, determine whether your command changed the link or its target. If it crosses into a mounted filesystem, verify that the mounted object supports the Unix ownership and mode semantics you expect.

5. Re-test as the real user

Running a command with sudo proves only that root can access the path. Re-run the application action as the service account or log in as the intended user, then inspect the newly created file’s owner, group, and mode.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Safe command patterns

Goal Command What to verify
Private configuration file chmod 600 config.env Only the intended owner needs to read it
Read-only document for a group chmod 640 report.txt The group is correct and others do not need access
Make one script runnable chmod u+x deploy.sh The script’s interpreter and directory traversal also work
Assign a service file sudo chown app:app data.db The service account and group names are correct
Prepare a collaborative tree sudo chown -R root:developers project/
sudo chmod -R a=,+rwX project/
Review the tree; add SGID or ACLs if group inheritance or named-user access is required

Common mistakes to avoid

  • Confusing permission and ownership: chmod cannot change the user owner, and chown cannot grant write permission that the mode denies.
  • Using chmod -R 755 indiscriminately: it marks every regular file executable. Prefer a targeted mode or X.
  • Assuming root is required for every change: owners can change mode bits, and users can select groups they belong to; only changing the user owner requires root.
  • Forgetting directory execute permission: users need x on each directory they must traverse.
  • Relying on an omitted group in scripts: use USER:GROUP, particularly on Ubuntu 25.10 and newer where uutils behavior may differ.
  • Changing a symlink target unintentionally: use chown -h or chgrp --no-dereference when the link itself is the object you intend to modify.
  • Making data world-writable: broad write access can allow unauthorized modification or replacement. Correct the owner, group, directory mode, or ACL instead.

A practical change procedure

  1. Identify the actual path: use pwd, absolute paths, and ls -ld to avoid acting on the wrong directory.
  2. Record the current state: save the output of ls -l, stat, and, where applicable, getfacl.
  3. Identify the process user: check the account and groups with id; do not assume your interactive login is the account that needs access.
  4. Select one control: use chmod for bits, chown for user ownership, and chgrp for group ownership.
  5. Apply the narrowest non-recursive change first: test it on one file or a staging directory.
  6. Handle inheritance deliberately: use SGID for a shared group and ACLs for named-user exceptions.
  7. Use recursion only after review: confirm the path, account for symlinks, and use X rather than making every regular file executable.
  8. Test as the intended user or service: verify both the requested operation and the ownership/mode of anything it creates.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.