RM:无法删除:权限被拒绝 [英] rm: cannot remove: Permission denied

查看:9040
本文介绍了RM:无法删除:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    max@serv$ whoami
    max
    max@serv$ ls -la ./defines.php 
    -rwxrwxrwx 1 max max 1985 2011-11-16 02:01 ./defines.php
    max@serv$ chmod 0777 ./defines.php 
    max@serv$ rm ./defines.php 
    rm: cannot remove `./defines.php': Permission denied
    max@serv$

我如何删除这个文件?

How can I delete this file?

推荐答案

在code说的一切:

max@serv$ chmod 777 .

好吧,不说的一切。

Okay, it doesn't say everything.

在UNIX和Linux,删除文件的能力的不可以由该文件的存取位决定。它是由包含该文件的目录的访问位决定。

In UNIX and Linux, the ability to remove a file is not determined by the access bits of that file. It is determined by the access bits of the directory which contains the file.

它认为这种方式 - 删除文件不会修改文件。您没有写入该文件,因此该文件事为什么要W?删除文件需要编辑指向文件的目录,所以你需要在该目录中的W。

Think of it this way -- deleting a file doesn't modify that file. You aren't writing to the file, so why should "w" on the file matter? Deleting a file requires editing the directory that points to the file, so you need "w" on the that directory.

这篇关于RM:无法删除:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆