• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

TechLila

Bleeding Edge, Always

  • Home
  • About
  • Contact
  • Deals and Offers
Techlila Logo
Share
Tweet
Share
Pin
2 Shares
Linux Top Distros
Up Next

Choosing a Linux Distro: Which Flavor of Linux is Best for Me?

Linux File Permissions: the Tutorial

TechLila Computer Linux

Linux File Permissions: the Tutorial

Avatar of Rajesh Namase Rajesh Namase
Last updated on: December 12, 2013

Linux provides full control over file access which ultimately helps many people to use the system. Files and data are maintained leaving no risks of them being changed, viewed, modified or deleted by any masquerader.

Linux File Permissions: the Tutorial

As you might be aware of the three types of users in Linux who may have access to the files:

  • User – An account created by the administrator of the system for a user to access that system. Accounts may also be created for machine processes, like the mail, FTP, or web server. Users have direct ownership over files and directories on the system.
  • Group – Provides the ability to give access to sets of users. Groups have their own permissions over each file or directory.
  • World – Anyone else that may attempt to access a file on the machine.

Three ways in which these types of people can access the file.

  • Read – Opening a file and looking at its contents.
  • Write – Overwrite, append, or delete a file. In directories, this may include creation of files.
  • Execute – The ability to “run” a program (or script).

The “most restrictive access” policy is used for granting any kind of permissions as and when needed. No one has access to anything for no reason.

Managing Permissions:

“chmod” (change mode) is a command for managing permissions.

chmod command in Linux

Basic syntax for this command is:

chmod [who][how to change][permissions to modify] [file or directory name]

The “who” can be:

  • u – user or account that owns the file
  • g – group that owns the file
  • o – others, or “world”, anyone else who may access the file
  • a – all of the above

The “how to change” can be:

  • = (equals) – set the permissions to exactly what immediately follows
  • + (add) – add the permission that immediately follows, leave others as-is
  • – (minus) – subtract the permission that immediately follows, leave others as they are

The “permissions to modify” can be, as we’ve discussed:

  • r – read
  • w – write
  • x – execute

Changing Owners and Groups:

1. chown

Two popular commands exist that can be used for modifying the owning user and group of a file. The first is “chown” (change owner).

The syntax for this is:

chown [user]:[group] [file or directory]

Let’s look at an example:
We have a file called “systems.lst”. We need to change its owner to a user called xyz who is in the abc group:
chown xyz:abc systems.lst

2. chgrp

Anyone intending to change the group, can use another command, called “chgrp” (change group”.

The syntax for this command is:

chgrp [group name] [file or directory name]

Here is an example:
There is a file called “run.sh” that we want to change to be owned by the abc group:
chgrp abc run.sh

Other Linux Commands:

  • useradd – add a system user
  • userdel – remove a system user
  • usermod – modify an existing system user. This can be used to perform several operations on a user’s account.
  • groupadd – add a group to the system
  • groupdel – remove a group from the system
  • groupmod – modify a group

We hope sharing this Linux Tutorial will indeed be useful to you, don’t forget to re share it.

Share
Tweet
Share
Pin
2 Shares

Disclosure: Content published on TechLila is reader-supported. We may receive a commission for purchases made through our affiliate links at no extra cost to you. Read our Disclaimer page to know more about our funding, editorial policies, and ways to support us.

Sharing is Caring

Share
Tweet
Share
Pin
2 Shares
Avatar of Rajesh Namase

Rajesh Namase

Rajesh Namase is a professional blogger and founder of TechLila blog. Also, he's a passionate entrepreneur, internet marketer, and fitness freak.

Category

  • Linux

Tags

Linux Commands, Linux Tutorials

Reader Interactions

What people are saying

  1. Avatar of TinhTinh

    Are you using Ubuntu? I heard that this system seems more secure than Windows. Thanks

    Reply
    • Avatar of Rajesh NamaseRajesh Namase

      Yes, Also I like Ubuntu Linux than Windows 7. Ubuntu system is more secure than Windows. Update regularly :)

      Reply
      • Avatar of HkrHkr

        Ubuntu is free and you can get a free CD with no shipping charges !!!

        Reply
        • Avatar of Rajesh NamaseRajesh Namase

          We already know that :)

          Reply
  2. Avatar of rotyyurotyyu

    What about using numbers to set permission? I’ve seen something like 655, 777, etc. Can you elaborate?

    Reply
    • Avatar of Rajesh NamaseRajesh Namase

      Please checkout this link: http://techli.la/18YXqvJ Scroll at the bottom.

      Reply

Add Your Comment Cancel reply

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

Primary Sidebar

Popular

How to Increase Broadband Speed on Windows

10 Best Android Launchers of 2021

Things to Do After Installing Windows 10 – Windows 10 Tips and Tricks

Top 10 Search Engines You Can Use to Search the Web Privately

55 Interesting Computer Facts That Will Blow Your Mind

What to Look for When Buying a Laptop – A Laptop Buying Guide

Fusion Drive Vs SSD – Things Nobody Tells you About Fusion vs SSD Storage

Useful Tools

• Grammarly – Free Grammar Checker
• SEMrush – The Best SEO Tool Trusted by Experts
• Setapp – One-stop subscription for Mac and iOS

Trending Topics

  • Android
  • Internet
  • iPhone
  • Linux
  • Macintosh
  • Security
  • Social Media
  • Technology
  • Windows

Worth Checking

10 Best Sound Equalizer for Windows 10 (2022 Edition!)

14 Best VLC Skins that are Highly Recommended and Free

Footer Logo Footer Text Logo

Footer

About

Hello and welcome to TechLila, the famous technology blog where you can find resourceful articles for mastering the basics and beyond.

At TechLila, our main goal is to provide unique information, such as quality tips and tricks, tutorials, how-to guides on Windows, Macintosh, Linux, Android, iPhone, Security and a few miscellaneous sub-topics such as reviews.

Links

  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms

Follow

Custom Theme Using Genesis Framework

Cloud hosting by Cloudways

Language

en English
bg Българскиzh-CN 简体中文nl Nederlandsen Englishtl Filipinofr Françaisde Deutschid Bahasa Indonesiait Italianoja 日本語pl Polskipt Portuguêsro Românăru Русскийsr Српски језикes Españolsv Svenskatr Türkçeuk Українськаvi Tiếng Việt

© Copyright  2012–2023 TechLila. All Rights Reserved.