++++++++++++++++++++++++++++++
การตั้งค่าสิทธิ์ไฟล์ของผู้ใช้จะมีด้วยกัน 3 สิทธิ์ คือ read, write และ execute
ในหนึ่งไฟล์เราต้องกำหนดสิทธิ์ดังนี้
user the user that owns the file
group user in the files group
other very other user
เมื่อเรารันคำสั่ง ls -l ใน Terminal จะแสดง file permission
เช่น -rwxrwxrwx จะหมายถึง user, group และ other จะสามารถ read write และ execute ได้
หนึ่งอักษรที่อยู่ข้างหน้าก่อนการระบุสิทธิ์จะบอกชนิดของไฟล์
ชนิดของไฟล์ที่เป็นไปได้มีดังนี้
- for regular file
d for directory
l for symbolic link
b for block special device
c for character device
s for Unix socket (local domain socket)
p for name pipe
ในบางครั้งเราจะพบการใช้เลขฐานแปดในการอ้างสิทธิ์ของไฟล์
Permissions | Symbolic | Binary | Octal |
read, write and execute | rwx | 111 | 7 |
read and write | rw- | 110 | 6 |
read and execute | r-x | 101 | 5 |
read only | r-- | 100 | 4 |
write and execute | -wx | 011 | 3 |
write only | -w- | 010 | 2 |
execute only | --x | 001 | 1 |
no permission | --- | 000 | 0 |
Changing Permission : chmod
1. ระบุประเภทของผู้ใช้ ใช้หนึ่งหรือมากกว่าหนึ่งตัวอักษร
u for the user
g for group
o for others
a for all three of the previous categories
2. ระบุสิทธิ์ว่าจะเพิ่ม(+) ลบ(-) หรือจะแทนที่ (=)
3. ใช่หนึ่งหรือมากกว่าหนึ่งอักษรเพื่อระบุสิทธิ์
r for read
w for write
x for execute
เมื่อ user สร้างไฟล์ ระบบจะมีการตั้งค่าเริ่มต้นสิทธิ์ของไฟล์อย่างไร?
นี่เป็นพื้นฐานของ user's umask value
- umask value จะระบุ permission ที่ไม่ได้มีการตั้งค่าไว้
- โดยปกติแล้วใน ubuntu ค่าเริ่มต้น umask value ที่ user จะเป็น 002 ในขณะที่ root จะเป็น 022
- เราสามารถตรวจสอบ umask value โดยการใช้คำสั่ง umask ใน command
- เราจะเห็น 0002 ในเลขฐานแปดจะนำหน้าด้วย 0 (เหมือนเลขฐานสิบหกที่จะนำหน้าด้วย 0x) ดังนั้นแล้วค่า umask value จริงๆคือ 002
- ค่า umask จะหักออกจากค่าพื้นฐาน777 คือ base valueของไดเร็กทอรี่ และ 666 base valueของไฟล์
- ค่า umask 002 หมายความว่า จะไม่ลบสิทธิ์ base value ของ “user” หรือ “group” แต่ใน "other” จะไม่อนุญาตให้ write ( write permission is octal 2 meaning -w- )
- สามารถตั้งค่า umask ใหม่โดยใชเคำสั่ง unmask newvalue ใน command
Linux file permission
Changing Permission
sample security settings for your A1 users
++++++++++++++++++++++++++++++
PostgreSQL
Grant Permissions in PostgreSQL
Remove Permissions in PostgreSQL
Use Group Roles in PostgreSQL
อ้างอิงจาก:
Permission in Postgres
GRANT Postgres Document
ALTER DATABASE Postgres Doc
sample database log
++++++++++++++++++++++++++++++
backup/restore data
++++++++++++++++++++++++++++++
PostgreSQL
อ้างอิงจาก:
Dump psql Doc
PDF File
+++++++++++++++++
-----------------------------------------------
ไม่มีความคิดเห็น:
แสดงความคิดเห็น