Raspberry Pi_Eng_13.1.1 Confirming Permission Information on File


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


13.1   Understanding Scheme of File Permissions

 

13.1.1  Confirming Permission Information on File

 

If you confirm file information on Linux system, you can determine permissions for that file.

 

Below is the contents of a directory called "testdata" that you have seen with the [File Manager] program on the window screen. You can see that the directory contains a file and another directory.

 


 

You can use "ls" command to determine the privilege information for a file on the Terminal screen as shown below.

 

ls    <directory/file>   -l

 

If you check the detailed information of directory with the "ls l" command on the Terminal screen, you can see the following file information. This information includes both general information and permission information about the file.

 

pi@raspberrypi ~ $ ls  testdata -l

total 16

drwxr-xr-x 2 pi pi 4096 Mar 24 02:26 manual01

drwxr-xr-x 2 pi pi 4096 Mar 24 02:26 manual02

-rw-r--r-- 1 pi pi   18 Mar 24 02:10 user_guide01.txt

-rw-r--r-- 1 pi pi   18 Mar 24 02:10 user_guide02.txt

 

The following is to show the information about a specific file among the above contents in a table format divieded by item.

 

d

rwx

r-x

r-x

type

owner user permission

owner group permission

other permission

 

2

pi

pi

4.0K

Mar 24 02:26

manual01

count

owner

group

size

create/change date & time

file name

 

The following is to subdivide the information on permission among the above information.

r

w

x

r

-

x

r

-

x

read

write

execute

read

write

execute

read

write

execute

owner user permission

owner group permission

other permission

 

The basic information about the values that can appear in each item of the file's details is summarized as follows:

 

   Type

d               -- Directory

-               -- Normal file

l               -- Link

c               -- Character device node

b              -- Block device node

p              -- Named pipe

s               -- Socket

 

This is the information that indicates the type of file. If the file is a directory, it is represented by "d". If it is a normal file, it is indicated by "-". If it is neither a file nor a directory, but a link, it is indicated by "l".

 

   Owner user permission

-               -- No permission

r               -- Read permission

w              -- Write permission

x               -- Execute permission     

 

   Owner group permission

-               -- No permission

r               -- Read permission

w              -- Write permission

x               -- Execute permission     

 

   Other permission

-               -- No permission

r               -- Read permission

w              -- Write permission

x               -- Execute permission     

 

   Count

1              -- File

2              -- Directory itself

3 or more    -- Directory itself + number of internal directory

 

   Owner user

It means a specific user account that has ownership of the file.

 

   Owner group

It means a specific user group that has ownership of the file.

 

   Size

Size of the file

 

   Create/change date & time

Create/change date & time of the file

 

   File name

Name of the file