Linux file permissions explained


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.

rThe file can be read
wThe file can be written to
xThe file can be executed as a program
File permission controls
rThe contents of the directories can be viewed
wContents of the directory can be modified
xThe user or group can use cd to navigate inside the directory.
Directory permissions control and their meaning

check file permissions in Linux

For example, navigate to your home folder and enter

ls -la

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.

check linux file permissions

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 NameView on Amazon
Dell PowerEdge R730 Server 2X E5-2670v3 2.30Ghz 24-Core 128GB H730 (Renewed) View on Amazon
Dell PowerEdge R630 Server | 2X 2.40GHz 16 Cores | 64GB | H330 | 8X 600GB 10K (Renewed)View on Amazon
PowerEdge Dell R640 Server | 2X Gold 6154 3.0GHz = 36 Cores | 512GB RAM | 8X 960GB SSD (Renewed)View on Amazon
Dell PowerEdge T320 Tower Server | 1X E5-2450 8 Cores | 32GB | H310 | 8TB Storage (Renewed)View on Amazon
Hewlett Packard Enterprise HPE ProLiant MicroServer Gen10 Plus v2 Ultra Micro Tower Server for Small Business, Xeon E-2314 2.8GHz, 64GB Memory, 4TB SSDView on Amazon
HP High-End Virtualization Server 36-Core 768GB RAM 16TB DL360 G9 (Renewed)View on Amazon
HP Proliant DL380 G9 Server / 2X E5-2670 V3 2.3GHz = 24 Cores / 256GB RAM / P840 / 12x 3TB SAS (Renewed)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 LANView on Amazon
Supermicro Superserver E300-9D-4CN8TP Intel Xeon D-2123IT Networking PC w/ 2X SFP+, 2X 10GbE LAN, 4X GbE LAN, IPMIView on Amazon

create a new file

Let’s create a new file and explore the Linux file permissions the system assigns.

touch example.txt
create a new file and check linux file permissions

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
set linux file permissions

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.

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’

linux file permissions - change ownership
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.”


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.

Full Disclosure

Any purchases made from clicks on links to products on this page may result in an affiliate commission for me. 

Please keep in mind that the quantity or price of items can change at any time.

As an Amazon  Associate, I earn from qualifying purchases.

As an Aliexpress Associate, I earn from qualifying purchases. 

Als Amazon-Partner verdiene ich an qualifizierten Verkäufen

Tech Expert & Blogger

Leave a Reply

Your email address will not be published. Required fields are marked *

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.