https://unix.stackexchange.com/questions/171519/lsof-warning-cant-stat-fuse-gvfsd-fuse-file-system

FUSE and its access rights

lsof by default checks all mounted file systems
including FUSE - file systems implemented in user
space which have special access rights in Linux.

As you can see in this answer on Ask
Ubuntu
a mounted GVFS
file system (special case of FUSE) is normally accessible only
to the user which mounted it (the owner of gvfsd-fuse).
Even root cannot access it. To override this
restriction it is possible to use mount options allow_root
and allow_other. The option must be also enabled
in the FUSE daemon which is described for example in this answer ...but
in your case you do not need to (and should not) change the
access rights.

Excluding file systems from lsof

In your case lsof does not need to check the GVFS
file systems so you can exclude the stat() calls
on them using the -e option (or you can just
ignore the waring):

lsof -e /run/user/1000/gvfs

Checking certain files by lsof

You are using lsof to get information about all processes running on your system and only then you filter the complete output using grep. If you want to check just certain files and the related processes use the -f option without a value directly following it then specify a list of files after the "end of options" separator --. This will be considerably faster.

lsof -e /run/user/1000/gvfs -f -- /tmp/report.csv

General solution

To exclude all mounted file systems on which stat() fails you can run something like this (in bash):

x=(); for a in $(mount | cut -d' ' -f3); do test -e "$a" || x+=("-e$a"); done
lsof "${x[@]}" -f -- /tmp/report.csv

Or to be sure to use stat() (test -e could be implemented a different way):

x=(); for a in $(mount | cut -d' ' -f3); do stat --printf= "$a" 2>/dev/null || x+=("-e$a"); done

lsof always tries to obtain some basic information about all filesystems, even if the arguments happen to imply that no result will come from a particular filesystem. If it's unable to access a filesystem (specifically, to call stat at its mount point, as the message says), it complains.

As root, you would normally have permission to access filesystems. However, due to the inner workings of FUSE, root does not automatically have all powers on a FUSE filesystem. This isn't a security feature (root can become the user who owns the filesystem and get access that way), it's a technical limitation.

GVFS-FUSE is a FUSE interface to GVFS, which is a mechanism that allows Gnome applications to access virtual filesystems implemented by Gnome plugins: GVFS grants non-Gnome applications access to these virtual filesystems via the regular filesystem interface.

-- 

刘林强

136-1133-1997
liulinqiang@unipus.cn
北京外研在线教育科技有限公司
外语教学与研究出版社

lsof and dynamic array in bash/shell的更多相关文章

  1. linux bash shell & lsof & grep & ps

    linux bash shell & lsof & grep & ps lsof list all open files # lsof & grep $ lsof -P ...

  2. 第四章:更多的bash shell命令

    第四章:更多的bash shell命令 监测程序 ps (其他ps内容见#1 ) Unix风格的ps命令参数 参数 描述 -A 显示所有进程 -N 显示与指定参数不符的所有进程 -a 显示除控制进程( ...

  3. 系统管理中 bash shell 脚本常用方法总结

    在日常系统管理工作中,需要编写脚本来完成特定的功能,编写shell脚本是一个基本功了!在编写的过程中,掌握一些常用的技巧和语法就可以完成大部分功能了,也就是2/8原则 1. 单引号和双引号的区别 单引 ...

  4. Linux 常用命令解析和Bash Shell使用示例脚本演示

     摘要 Linux命令是基于文本格式输入输出的一种程序,依照Unix哲学中强调的程序功能简单,输入宽松,输出严谨,各种程序组合能够具有更强大的功能,而具有这样的灵活性的主要原因是Linux规定程序 ...

  5. 《Linux命令行与shell脚本编程大全》- 读书笔记2 - 更多的bash shell命令

    更多的bash shell命令 想检测进程,需要熟悉ps命令的用法.ps命令好比工具中的瑞士军刀,它能输出运行在系统上的所有程序的许多信息.默认情况下,ps命令只会显示运行在当前控制台下的属于当前用户 ...

  6. 鸟哥的Linux私房菜——第十四章:Bash Shell

    视频链接:http://www.bilibili.com/video/av10094012/ 本章目录: 1. Bash shell1.1 什么是 shell ? (我们通过shell与Kernel核 ...

  7. linux 9 -- 交互式使用Bash Shell

    二十二. 交互式使用Bash Shell:     1.  用set命令设置bash的选项:     下面为set主要选项的列表及其表述: 选项名 开关缩写 描述 allexport -a 打开此开关 ...

  8. bash shell

    Linux的shell 与windows只有一种批处理脚本不同,由于早年的Unix年代,发展者众,出现了各种不同的distribution,因此也随着不同的distribution出现了各自的shel ...

  9. Bash Shell内建命令和保留字

    Bash Shell内建命令和保留字命令含义!保留字,逻辑非:不做任何事,只做参数展开.读取文件并在shell中执行它alias设置命令或命令行别名bg将作业置于后台运行bind将关键字序列与read ...

随机推荐

  1. netty实现多个handler顺序调用

    在netty中,一次数据交互,可以由多个handler去处理,例如 handler1 和 handler2,那么,在前面那个handler的 messageReceived 的最后要加上 ctx.se ...

  2. [svc]HTTPS证书生成原理和部署细节

    参考: http://www.barretlee.com/blog/2015/10/05/how-to-build-a-https-server/ 今天摸索了下 HTTPS 的证书生成,以及它在 Ng ...

  3. 利用linux的mtrace命令定位内存泄露(Memory Leak)

    一谈到内存泄露, 多数程序猿都闻之色变. 没错, 内存泄露非常easy引入. 但非常难定位.  以你我的手机为例(如果不常常关机). 如果每天泄露一些内存, 那么開始的一个星期, 你会发现手机好好的. ...

  4. COMBINATORIAL TESTING

    COMBINATORIAL TESTING -Test note of “Essential Software Test Design” 2015-09-06 Content 16.1 Coverag ...

  5. QT-Qt获取当前时间并格式化输出及将积秒转换成时间

    https://blog.csdn.net/u012199908/article/details/50731543 格式化输出当前时刻qDebug()<<"currentTime ...

  6. 转载——githup的提交

    Github是管理软件开发的首选托管网站,12306的火车票插件一时让国内当时很多小白开发者(当然也包括我)认识到了这个网站.GitHub可以托管各种git库,并提供一个web界面,与 SourceF ...

  7. 【转载】VC维,结构风险最小化

    以下文章转载自http://blog.sina.com.cn/s/blog_7103b28a0102w9tr.html 如有侵权,请留言,立即删除. 1 VC维的描述和理解 给定一个集合S={x1,x ...

  8. USI和USCI的区别

    在 MSP430 系列中微控制器中有三种串行通讯模块.它们分别是 USART . USI 和 USCI . USART 支持同一硬件模块的两种串行模式,分别是 UART 和 SPI . USART 实 ...

  9. govendor使用

    一,开发端 前提是有一个已经go get过依赖包,并编译成功的项目. $ go get -u github.com/kardianos/govendor $ cd project_dir $ gove ...

  10. Python 中filter函数用法

    filter()和map一样,接收一个函数和一个序列.和map不同的是,filter()把传入的函数依次作用于每个元素,然后根据返回值是True还是False决定保留还是丢弃该元素 过滤出奇数: de ...