Config default permission for vsftpd

กำหนดค่า default permission ให้ vsftpd

ใช้ vsftpd เป็น FTP server แล้วเมื่อ up ไฟล์ขึ้นแล้ว เมื่อเรียกใช้งานปรากฎว่าเจอ err ดังนี้

Forbidden
You don’t have permission to access

กรณีนี้เกิดจากปัญหาของสิทธิ์ในการใช้งาน แก้ไขโดยใช้ chmod แต่ต้องทำทุกไฟล์คงไม่สะดวกแน่ หลังจากหาข้อมูลอยู่นาน ผมลองทำตามนี้แล้วได้ผล

แก้ไขไฟล์ vsftpd.conf

ปกติอยู่ที่ /etc/vsftpd/vsftpd.conf

สำคัญที่สองบรรทัดนี้

file_open_mode=0777
local_umask=0022
# ปกติถ้าไม่กำหนด file_open_mode จะเป็น ค่า 0666 ที่เรา set เป็น 0777 เพราะต้องนำค่านี้ ไป AND NOT กับค่า umask ถ้าไม่ set เป็น 0777 จะไม่สามารถหาค่า umask ที่มา AND กับ 0666 แล้วได้สิทธิ์ครบตามที่เราต้องการ

ค่าของ umask ที่จะนำไปใส่ ใช้ตามตารางข้างล่างนี้เลยครับ

ค่า(เลขฐาน 8 ) สิทธิ์ที่ได้

0 r w x read, write and execute
1 r w – read and write
2 r – x read and execute
3 r – - read only
4 – w x write and execute
5 – w – write only
6 – - x execute only
7 – - – no permissions

เช่น..

file_open_mode=0777
local_umask=0022

ก็จะหมายถึง rwx r-x r-x หรือ 755 นั่นเอง

source : http://gotoknow.org/blog/suratat/146921

Advertisement

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.