Linux Server Configuration


Changing the Ownership of a Directory and Its Contents


Download 493.5 Kb.
bet17/48
Sana16.06.2023
Hajmi493.5 Kb.
#1495871
1   ...   13   14   15   16   17   18   19   20   ...   48
Bog'liq
0501-linux-server-configuration

3.5 Changing the Ownership of a Directory and Its Contents


A common requirement is to change the ownership of a directory and its contents. Both chown and chgrp accept a -R (Mnemonic: ‘recursive’) option:


# chgrp -R staff shared-directory


The above command changes the group ownership of shared-directory and its contents and its subdirectories, recursively to staff. Changing user ownership (superuser only):


# chown -R root /usr/local/share/misc/




3.6 Manage File Permission to Control Access to Files


A permission represents an action that can be done on the file. There are three types of permissions to a file; each denoted by a letter:





Permission

Letter

Description

Read

r

Permission to read the data stored in the file

Write

w

Permission to write new data to the file, to truncate
the file, or to overwrite existing data

Execute

x

Permission to attempt to execute the contents of the
file as a program

The r,w,x permissions also have a meaning for directories:





Permission

Letter

Description

Read

r

Permission to get a listing of the directory

Write

w

Permission to create, delete, or rename files (or
subdirectories) within the directory

Execute

x

Permission to change to the directory, or to use the
directory as an intermediate part of a path to a file

As well as having different types of permission, we can apply different sets of permissions to different sets of people. A file (or directory) has an owner and a group owner. The r,w,x permissions are specified separately for the owner, for the group owner, and for everyone else (the ‘world’).



Download 493.5 Kb.

Do'stlaringiz bilan baham:
1   ...   13   14   15   16   17   18   19   20   ...   48




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling