By Edy, Tech Expert & Blogger

Introduction
In this article, I explain how Linux file permissions work. I use the Linux distribution Ubuntu. I’m an experienced Windows administrator and coming to Linux file permission is quite a change.
With Linux, each file or directory has both a user and group that take ownership of it. This is in contrast to platforms such as Windows, which can have multiple groups assigned to one resource. With Linux, just one user or group can be assigned to each file or directory.
How Linux file permissions work
The way Linux handles permissions for files is fundamentally different than Windows; instead of assigning ownership to individual users, every file has three sets of reading/write/execute permissions: Owner (the user who created the file), Group (anyone else who belongs to a particular group) and Other (everyone else).
What are the three types of access permissions for a file or directory in Linux?
– Read permission allows you to view the contents of that particular file or directory but no writing is allowed, this means if you want to edit the file you will need to change it back manually.
– Write permission allows you to make changes on the content of that particular file or directory, this includes saving changes made by other people as well as adding new files.
– Execute permission allows you to execute the file or directory that it is on. This means if you run a program from that particular file or directory it will start.
Files | |
r | The file can be read |
w | The file can be written to |
x | The file can be executed as a program |
Directories | |
r | The contents of the directories can be viewed |
w | Contents of the directory can be modified |
x | The user or group can use cd to navigate inside the directory. |
check file permissions in Linux
For example, navigate to your home folder and enter
ls -la
pwd
The command ‘pwd’ shows where you are in the file system. I’m at /home/edywerder. My personal home folder. ‘ls -la’ lists all the files in the folder.

The first row shows the file permissions read/write/execute
It’s broken down into three groups, ‘user’, ‘groups’ and ‘others’ Basically it tells you which permission each has.
The second column shows the user who owns the file
The third column shows the name of the group that owns the file
Check out the table below for great deals on servers available on Amazon.
Product Name | View on Amazon |
---|---|
PowerEdge Dell R630 Server | 2X E5-2690 v4 = 28 Cores | 128GB RAM | 2X 1TB SSD (Renewed) | View on Amazon |
Dell PowerEdge R730 Server 2X E5-2680v4 2.40Ghz 28-Core 128GB 8X 4TB 12G H730P (Renewed) | View on Amazon |
HPE ProLiant MicroServer Gen10 Plus Server with one Intel® Xeon® E-2224 Processor, 16 GB Memory, and 4 Large Form Factor (LFF) Non-hot Plug Drive Bays | View on Amazon |
ProLiant MicroServer Gen11 Tower Server w/one Intel Xeon E-2434, 3.4GHz 4-core 1P 32GB-U VROC 4LFF‑NHP 4TB HDD iLO KIT 180W External PS (HPE Smart Choice P74440-005) | View on Amazon |
Lenovo ThinkSystem ST250 V2 Business Tower Server Desktop, Intel Xeon E-2336 Hexa-Core 2.9GHz Processor up to 4.8GHz, 16GB DDR4 3200 MHz UDIMM, No Storage, USB 3.0, No Wi-Fi, No OS, Black | View on Amazon |
Supermicro SYS-5019D-4C-FN8TP Xeon D-2133IT Quad Core Front I/O Short Depth 1U Server, 2X SFP+, 2X 10GBase-T, 4X GbE LAN | View on Amazon |
Supermicro E300-9D-8CN8TP Mini PC Server - Xeon D-2146NT - Serial ATA/600 Controller - ASPEED AST2500 Graphic Card - 10 Gigabit Ethernet | View on Amazon |
create a new file
Let’s create a new file and explore the Linux file permissions the system assigns.
touch example.txt

The permissions are assigned by using the groupings “rwx” and “r-x”.
We see the owner is the user ‘edywerder’ and the group owner is ‘edywerder’. Permissions for the user and group is ‘read’, ‘write’, and no rights for any other user. Btw the ‘d’ means a folder. For example here ‘.cache’ or ‘.local’ is a folder.
As you know from my article about ‘manage User and Groups‘, when you create a new user, a group with the same name is created too. Here you see the group will be assigned automatically as the group owner.
Setting permissions on files and folders – chmod
Use the command chmod to change the permissions on files or folders. In this example, I didn’t specify the folder where the files are located. Because I’m already in the folder. You would need to specify the exact location in case you are not in the current folder.
chmod 777 example.txt

I set the permission to 777 which means everyone has the full right on the file. I recommend using the chmod calculator. It’s a super tool to set easily the permissions. The chmod commands also have options like ‘-r’ for recursive. Use it to change permissions for a folder and every file underneath the folder.
I was using the octat values which I think is the most common way to change the permission. Again super easy with the chmod calculator.
Permissions | bit |
Read | 4 |
Write | 2 |
Execute | 1 |
no permission | 0 |
If we add all three we get 7, so 777 is the highest permission level for all
Changing the ownership – chown
Chown is the Linux command to change the ownership for a file or folder
chown root:root example_ownership.txt
In this example, I change the ownership for the user and group in one go to the user ‘root’

sudo chown :edy example_ownership.txt
Would set the group to ‘edy’
sudo chown edy example_ownership.txt
In this example, I change the ownership of the user only. User ‘edy’
You can also use the option ‘-R’ to change recursively ownership of any files in the folder
sudo chown -R :edy folder
This example would change ownership of the group to ‘edy’ for the folder named ‘folder’ and for all files inside the folder
Another command worth knowing is the chgrp command, which allows you to directly change the group ownership of a file. To use it, you can execute the chgrp command along with the group you’d like to own the file, followed by the username.
A command worth knowing is chgrp, which allows you to change a file’s group ownership directly. The chgrp command can be executed along with the group you wish to own the file.
sudo chgrp edywerder example1.txt
It is very important for you to set the permissions on your files and directories so that your server is secure. If you are not familiar with Linux file permissions, it will take some time to learn. The best way to learn about Linux file permissions is by doing it yourself. Create some files and directories (as well as users) and set their permissions, then try removing a user’s access to the resource. Try to access that resource as that user anyways and see what errors you get. Fix those errors, then go through more examples before you do this again. With practice, you should be able to get familiar with this system really quickly.”
Conclusion
Linux file permissions are one of the most important aspects of security on a system. To set up your own, you’ll need to understand how they work and what each type means. The two commands for changing them are chmod and chown, which can be used together or separately depending on your needs.
Check out my article Managing Users And Groups if you want in-depth information about user management, including assigning groups to users so that they have access to certain files when logged into the system with their account credentials.
Keep in mind that there are some key differences between Windows and Linux systems – including their default user groups– so be sure you have a firm grasp on what those differences mean for your system before making changes.
Tech Expert & Blogger
Hi, I’m Edy. With over 30 years of experience in the IT industry, I’ve tackled numerous tech challenges.
As a solopreneur, I write articles to fill the gaps I notice in my work and online.
My mission? To provide clear, step-by-step tech guidance and improve the information you find on the web
Enjoying the content?