rm: 无法删除"/run/user/root/gvfs": 是一个目录 问题

时间:2023-03-09 22:47:32
rm: 无法删除"/run/user/root/gvfs": 是一个目录 问题
2013-03-02 
bxd@linux:~$ sudo su
[sudo] password for bxd: 
root@linux:/home/bxd# exit
exit
rm: 无法删除"/run/user/root/gvfs": 是一个目录
bxd@linux:~$ 
------------------------------
这似乎是一个bug, 我也不清楚怎么回事。 解决办法好像是在退出之前运行 umount /run/user/root/gvfs ,然后就可以删除这个目录了。
参见 : 
http://askubuntu.com/questions/233668/r ... -directory
https://bugs.launchpad.net/ubuntu/+sour ... ug/1077569
******************************
root下无法读写文件探究
2012-08-24 
1 在root权限下无法复制~/.gvfs/,也无法删除~/.gvfs/
备份/home时出错
/usr/share/backup# ./backup
  cp: 无法获取"/home/hic/.gvfs" 的文件状态(stat): 权限不够
  tar: 2012-08-24_17_06_53:无法 stat: 没有那个文件或目录
  tar: 由于前次错误,将以上次的错误状态退出
.....................................
6 尝试卸载~/.gvfs/,竟然成功 
按照网上的说明,使用mount卸载
~# umount .gvfs/
没有报错,说明卸载成功
7 ~/.gvfs是gvfs-fuse的挂载点 
下面是一段关于gvfs的介绍:
  What is the "fuse-daemon"?
  gvfs-fuse-daemon mounts your network connections as local file
  systems. The .gvfs dir is where any mounted network/other file systems
  are stored.
  For example: if you connect to you cellphone via the other:\\ prtocol,
  that directory wiil be mounted under the .gvfs dir so that legacy
  applications can access it.(like the terminal)
8 卸载之后 
~# ll | grep .gvfs/
  drwx------  2 hic  hic   4096  8月 21 19:15 .gvfs/
此时,已经可以使用root进入,也可以复制甚至删除。
9 重启之后此文件仍旧会出现 
但是它的权限仍旧和之前未卸载一样,root权限下不能复制和删除。
10 在root权限下仍旧不能查看 
~$ sudo -s
~# ll -d .gvfs/
  ls: 无法访问.gvfs/: 权限不够
11 在一般用户权限下,却能查看,复制甚至删除 
~$ ll -d .gvfs/
  dr-x------ 2 hic hic 0  8月 24 18:43 .gvfs//
12 找到网上的一篇说明 
  There is FUSE virtual filesystem mounted at ~/.gvfs.  For the majority
  of filesystem acceses, permissions are ignored for the root
  user. However, FUSE virtual filesystems mounts are one of the rare
  exceptions. FUSE virtual filesystems normally restricted to user who
  mounted them. In this case , the gvfs-fuse-daemon command(run as part
  of your desktop session)created this mount, belonging to you, and
  no-one else can access it, including root.
它的意思就是,该文件可以在普通用户权限下进行更改,但是除了该用户之外,
其它用户不可能对其进行读取或者删除,包括root也一样。
13 小结
在备份/home的时候,不能用root,否则无法复制.gvfs/出现错误。正确的做法是,以普通权限备份,这样就能避免该错误的发生。