Archive:Docs/Drafts/AdministrationGuide/Permissions/Introduction

From FedoraProject

Jump to: navigation, search

Contents

Permissions

Introduction

Managing permissions is an important task to be familiar with. There are many tools available such as chown, chgrp, and chmod. There are two methods available for managing permissions using command line tools: symbolic and numeric. The symbolic method uses symbols such as u, +, x, r, and so on, to represent owners, groups, and permissions. The numeric method uses a numbering scheme.

Each file and directory has permissions for the owner (UID), group (GID), and everyone else. The permissions for each group consist of three (binary) bits. There are 10 bits in total: --- --- --- (the 10th bit is the setuid or sticky bit - this will be described later). The first three are the permissions for the owner. The next three are the permissions for the group, and the last three are the permissions for everyone else.

Use the ls -l command to view file and directory permissions:

ls -l file1
-rw-rw-r-- 1 user1 group1 0 Oct 22 17:51 file1

The above example shows the following permissions for the file1 file:

The three main symbols used to represent permissions are r, w, and x. These represent read, write, and execute permissions respectively. File permissions are as follows:

Permissions for directories are as follows:

ls -l test1/
ls: cannot access test1/file1: Permission denied
ls: cannot access test1/file2: Permission denied
total 0
-????????? ? ? ? ?                ? file1
-????????? ? ? ? ?                ? file2
Important.png
Directory write Permissions
If a user has write permissions on a directory, that user can remove any file within that directory regardless of file permissions.

Symbolic Method

The following table describes the symbols used to change permissions using the symbolic method. Familiarize yourself with this table before proceeding to the next section:

uthe owner of the file or directory
gthe group the file or directory belongs to
oeveryone else
aeveryone (u, g, and o)
add a permission
=assign a permission
rread permissions
wwrite permissions
xexecute permissions
tdirectory sticky bit
ssetuid or setgid

Examples of using the chmod command to change file permissions can be found in the Managing Permissions Using the CLI section.

Numeric Method

The following table describes the numbering scheme used when changing permissions using the numeric method:

NumberPermissionsls -l Output
0no permissions---
1execute--x
2write-w-
3write and execute-wx
4readr--
5read and executer-x
6read and writerw-
7read, write, and executerwx

Use the chmod command to change permissions regardless of whether you are using the symbolic or numeric method.

Previous Page - TOC Next Page: Managing Permissions Using the CLI