Folder permission 問題

如果我想 set 到一個 Folder入面, 每個人都可以 Create 自己的 file, 但只有 owner 可以 edit 同 delete 自己的 file, 其他人只可以 Read, 咁要點樣 set folder 的 permission?

本帖最後由 cal22cal 於 2014-11-28 08:24 編輯

say, the target dir named as /home/share
users can create, read all files but can only be del/append by the creator
try this as root
  1. create dir  # mkdir /home/share
  2. set the dir group # chown root:users
  3. set the group write right # chmod g+w /home/share
  4. set the sticky bit on the dir # chmod +t /home/share

  5. create file by user a say ~  ls -l /home > /home/share/ a
  6. create file by user b say ~  ls -l /home > /home/share/ b

  7. both created files can be read by user a & b
  8. but only can be append/del by owner respectively
複製代碼
might have typo, though

TOP

留名做LOG

TOP

用chmod指令,   詳情請用Google查閱細節, 只要設定 非 file owner就可以了.  linux最基本的教程都有許多例子.

TOP

回覆 2# cal22cal


    Thanks 師兄~ 原來要用 sticky bit 先做到.......
我一 set 個 folder 做 rwxrwxrwx, 入面 d file 就可以俾所有人 modify/delete.... 就算 d files 已經係 rw-r--r--
試左好耐.... 原來係要 set sticky bit 先得 ><

TOP

When your folder is rwxr-xr-x, so only user can write, while group and other can read and access the folder. Then the files permission are only rw-r--r--, shouldn't this get what you want already?

TOP

其實你想做嘅嘢, 咪同平時個 /tmp 一樣囉?
chmod 1777 /xxxxx/xxx/ 咁就得了
(第一個1係第一個sticky bit, 仲有第二個 sticky bit 可以玩, 自己得閒試下)

TOP

sticky bit

TOP

sticky bit 又學到野....

TOP

除左FILE permission  好似可以用ACL做到你講既野...
可以BY USER SET...

TOP