• Skip to main content
  • Skip to after header navigation
  • Skip to site footer

Free-Mail

  • Events
  • Images
    • Instagram Goodness
  • Music
  • News
  • Software

Fix file permission errors on Linux

Fix file permission errors on Linux: Fix file permission errors on Linux Seth Kenlon Mon, 08/08/2022 – 03:00

1 reader likes this
1 reader likes this

If you’re sharing files between two users over the network or “sneaker net” (saving a file to a hard drive and copying it to a computer), you may encounter permission errors when you try to read or write the file. Even if you understand the concept of file permissions, you may not know exactly how to diagnose the problem or solve it. I used to perform data migration as a service, so I’ve run into my fair share of permission errors and ownership conflicts. Here’s how I fix them fast.

1. Determine the correct user

Before you can fix a permission error, you must determine who requires permission. You might think you already know that, but what you may not realize is that the user name isn’t the most definitive attribute of user identity. Your computer doesn’t see you as a person so much as it sees you as a number. To learn your number, take a look at your user ID:

 
$ id --user
1005

2. Get the current owner

Next, determine the owner of the file you’re unable to interact with. Because there’s a file permission problem happening, you may need to use the sudo command to see the information about the file:

 
$ sudo ls --numeric-uid-gid
-rw------- 1 1000 100  23041 Aug  2 05:26 bar
-rw------- 1 1000 100  54281 Aug  2 04:58 baz
-rw------- 1 1000 100    822 Aug  2 08:19 foo

In this example, the user owning the files is identified as user ID 1000, and that’s why user ID 1005 can’t interact with them. Worse yet, the files are marked as readable and writable only by the user that owns them, so not even members of the same group can interact with the files.

More Linux resources
Linux commands cheat sheet
Advanced Linux commands cheat sheet
Free online course: RHEL technical overview
Linux networking cheat sheet
SELinux cheat sheet
Linux common commands cheat sheet
What are Linux containers?
Our latest Linux articles

3. Change permissions to match

You know the user requiring permission, so you can change the current owner to match your current user:

 $   sudo chown 1005 foo

You can also grant members of your group, and possibly other users on the system, access to the files by changing the file mode. For instance, to maintain read and write permissions (7) while granting read permissions (4) to the group and any other user:

 $   sudo chmod 744 foo

Learn more

File permissions can seem tricky when you’re not comfortable with them. For more information on how file ownership works, read Introduction to chown. For more information on how file permissions work, read Introduction to chmod.

Don’t let file permissions slow you down. Here’s how to manage them on Linux and macOS.

open source button on keyboard
Image by:

Opensource.com

Linux
Mac

What to read next
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.
Register or Login to post a comment.

: Opensource.com Seth Kenlon

Supporting Open Source.

Have you tried: Diving with Sharks?

Share this:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Pinterest (Opens in new window) Pinterest
  • Email a link to a friend (Opens in new window) Email
  • More
  • Share on Tumblr (Opens in new window) Tumblr
  • Print (Opens in new window) Print
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit
Published on 8 August 2022 by Alan Category: SoftwareTag: errors, File, Linux, Permission

Cool Heron portrait 2 image

A nice Kings Beach image: Heron portrait 2 Image by PaulBalfe Kings Beach, Caloundra Image …

Read moreCool Heron portrait 2 image

Free Software: How to Save $5000 on the Most Popular Software Titles Reviews

Free Software: How to Save 00 on the Most Popular Software Titles Software can be very …

Read moreFree Software: How to Save $5000 on the Most Popular Software Titles Reviews

From the Ground Up – Plein Air and Pottery

From the Ground Up – Plein Air and Pottery – a Beauty interest event taking place on …

Read moreFrom the Ground Up – Plein Air and Pottery

About Alan

Previous Post:Mike and Mayo Wedding Booth 071
Next Post:Cool Cape Town_2012 05 13_0263 image

Reach Trust

Reach Trust is a holding trust for a number of companies within the Stratlec Group.

Copyright © 2026 · Free-Mail · All Rights Reserved · Powered by Straton Electrical

Back to top