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

The Urban Penguin

The Urban Penguin - Linux Training

  • Home
  • About
  • Programming
    • Master Editing Text Files Using VIM
    • Learn Shell Scripting with BASH
    • PERL Scripting in Linux
    • Ruby Scripting in Linux
    • Scripting with PowerShell
    • Learn C Programming using Linux and the Raspberry Pi
    • General Java Tutorials
    • Java 7 OCA Exam 1ZO-803
  • OS Tutorials
    • Red Hat and CentOS Training
      • Red Hat Enterprise Linux System Administration 1 – RH124
      • RHCSA – System Admin 2 – RH134
      • RHCE – EX294 – Automation With Ansible
    • Learning Ubuntu
    • LPI Training
      • LPI Linux Essentials
      • LPIC-1 Linux Administrator
      • LPIC-2 Certified Linux Engineer
      • LPIC-3 Senior Level Certification
        • LPIC-3 Exam 300 : Mixed Environments
        • LPIC-3 Exam 303 : Security
        • LPIC-3 Exam 304 : Virtualization and High Availability
    • Linux Technologies
      • Apache HTTPD Server
      • Learning PHP
      • Learning PUPPET
      • Learning SAMBA
      • Linux File-Systems
      • Monitoring with Nagios Core
      • MYSQL
      • openLDAP Directories on Linux
You are here: Home / Linux / LPI Linux Essentials / 5.3 Managing File Permissions and Ownership

5.3 Managing File Permissions and Ownership

August 17, 2013 by The Urban Penguin

Weight2
DescriptionUnderstanding and manipulating file permissions and ownership settings.

Key Knowledge Areas:

  • File/directory permissions and owners.

The following is a partial list of the used files, terms and utilities:

  • ls -l.
  • chmod, chown.

Nice to know:

  • chgrp.

For this objective we take a look at the permissions or “mode” of a file, (or directory).  The permissions can be set for the:

  • user owner
  • group owner
  • and others

The available permissions are simply read, write and execute. Execute permissions to a directory mean that you can enter the directory, or more specifically traverse the directory link, the word enter works perfectly well for me 🙂

The permissions for a file are normally read from the long listing of ls (/bin/ls):

ls -l

for a file or, for a directory:

ls -ld

The permissions shown from ls are displayed in symbolic form, ie rwx. Permissions can in set in symbolic format or octal format such as 755. If you would like to display the permissions in octal format, the command stat (/usr/bin/stat) could be used:

stat -c %a /etc (octal)
stat -c %A  /etc (symbolic)
Output from stat
Output from stat

From the output above we can see the 755 permissions relate to rwxr-xr-x.

We can use chmod (/bin/chmod) to set the permissions whereas we use ls -l to display permissions, ls -ld is needed to display the permissions for a directory. When using chmod there are two methods of setting permissions, with octal or symbolic notation:

  • chmod 755 file1
  • chmod u=rwx,g=rx,o=rx file

Ownership of files can be changed using chown (/bin/chown) to change the user owner and chgrp (/bin/chgrp).



Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to print (Opens in new window)

Filed Under: LPI Linux Essentials Tagged With: Linux Essentials, LPI, Permissions

Primary Sidebar

Newest Video

The Urban Penguin On Youtube

Categories

Pages

  • About The Urban Penguin
  • Contact Us
  • Linux Technologies
    • Apache HTTPD Server
    • Learning PHP
    • Learning PUPPET
    • Learning SAMBA
    • Linux File-Systems
    • Monitoring with Nagios Core
    • MYSQL
    • openLDAP Directories on Linux
  • LPI Training from The Urban Penguin
    • Complete Linux Essentials
    • Live and Pluralsight hosted courses
    • LPI Linux Essentials
    • LPI Linux Essentials for Raspberry Pi
    • LPIC-1 Linux Administrator
    • LPIC-2 Certified Linux Engineer
    • LPIC-3 Senior Level Certification
      • LPIC-3 Exam 300 : Mixed Environments
      • LPIC-3 Exam 303 : Security
      • LPIC-3 Exam 304 : Virtualization and High Availability
  • Online Instructor-led Courses
    • Bash Scripting Masterclass
    • Nftables Masterclass
    • Red Hat Enterprise Linux System Administration 1 – RH124
    • SELinux Masterclass
  • OpenStack
    • Citrix Videos
    • Pluralsight
    • Raspberry Pi Tutorials
    • Udemy
  • Operating System Tutorials
    • Learning SUSE
    • Learning Ubuntu
    • Linux Foundation Training
    • Red Hat and CentOS Training
      • RHCE – EX294 – Automation With Ansible
      • RHCSA – System Admin 1 – RH124
      • RHCSA – System Admin 2 – RH134
    • Solaris 11 OCA 1ZO-821
  • Scripting – the power of repetition!
    • General Java Tutorials
    • Java 7 OCA Exam 1ZO-803
    • Learn C Programming using Linux and the Raspberry Pi
    • Learn Shell Scripting with BASH
    • Master Editing Text Files Using VIM
    • PERL Scripting in Linux
    • Ruby Scripting in Linux
    • Scripting with PowerShell

© 2022 The Urban Penguin · All Rights Reserved