红联Linux门户
Linux帮助

Linux文件夹可写不可删除

发布时间:2008-03-22 01:07:37来源:红联作者:tljhl
给Hongkong那边ftp给配置好了,突然想到应该得让用户能够上传,但是不能删除文件,在windows下很容易实现,可是在Linux里面咋办呢?

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

不行,得另外想办法才成

想到去年碰到一件事,一个目录死命都无法删除,后来使用chattr

是不是可以利用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,果然不能删除了

大功告成。
文章评论

共有 0 条评论