Linux文件夹可写不可删除

给Hongkong那边ftp给配置好了,突然想到应该得让用户能够上传,但是不能删除文件,在windows下很容易实现,可是在Linux里面咋办呢?

使用samba倒是可以控制,难不成我为了这个还去专门配置一个samba -_-

不行,得另外想办法才成

想到去年碰到一件事,一个目录死命都无法删除,后来使用chattr具体可看我这篇日志《目录的奇怪属性 drwS-w-rwt

是不是可以利用chattr来达到目的呢?

man了一下chattr命令,发现:

A file with the `a’ attribute set can only be open in append  mode  for
       writing.    Only   the   superuser   or   a   process   pessessing  the
       CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

好像可以达到目的呢 ^_^

试验了一下chattr +a /tmp/aaa

lsattr

—–a——- ./aaa

然后登录ftp,果然不能删除了 ^_^

大功告成。。。

本文地址 : http://www.foolpig.com/2008/03/19/linux-write-nodelete/
如果你对本文感兴趣,欢迎订阅我的博客

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

Leave a Reply

:grin: 点击插入更多表情 »