开发者社区> 问答> 正文

Linux 文件权限设置问题

在Linux下如何设置一个目录可读、可写、不可删除,但是目录内的文件可以删除?

展开
收起
a123456678 2016-06-16 17:18:26 1937 0
1 条回答
写回答
取消 提交回答
  • 把它作为一个mount point。

    例:

    准备一个镜像(当然你也可以直接用一个分区)

    felix021@ubserver:~/test$ dd if=/dev/zero of=disk bs=1M count=128
    128+0 records in
    128+0 records out
    134217728 bytes (134 MB) copied, 0.779999 s, 172 MB/s
    felix021@ubserver:~/test$ mke2fs disk
    mke2fs 1.42 (29-Nov-2011)
    disk is not a block special device.
    Proceed anyway? (y,n) y
    ...
    Allocating group tables: done
    Writing inode tables: done
    Writing superblocks and filesystem accounting information: done
    挂载

    felix021@ubserver:~/test$ sudo mount -oloop disk mnt
    删除

    felix021@ubserver:~/test$ sudo rm -rf mnt
    rm: cannot remove `mnt': Device or resource busy

    2019-07-17 19:41:28
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载