Friday, October 19, 2007

Quyền truy cập file trên Linux

Có 3 loại user tồn tại trên Linux:
1) user
2) groups
3) Others

User: Là tên owner file. Mặc định người tạo file sẽ là owner của file.

Group: Là nhóm user là owner của file.

Có 3 loại quyền:

  • Quyền đọc (read)
  • Quyền ghi(write)
  • Quyền thực thi (execute)

Xem quyền truy cập của file

ls -l

Ví dụ:

me@mytux: /home/writers$ ls -l
total 17
drwxr-xr-x 3 nana writers 80 2005-09-20 21:37 dir
-rw-r----- 1 nana writers 8187 2005-09-19 13:35 file
-rwxr-xr-x 1 nana writers 10348 2005-07-17 20:31 otherfile

Ký hiệu:

d = directory
- = regular file
l = symbolic link
s = Unix domain socket
p = named pipe
c = character device file
b = block device file
r = read permission
w = write permission
x = execute permission
- = no permission
4 = read (r)
2 = write (w)
1 = execute (x)
0 = no permission (-)

Permission numbers
0 ---
1 --x
2 -w-
3 -wx
4 r--
5 r-x
6 rw-
7 rwx

No comments: