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. Python进度条小实例

    代码理解: 函数view_bar(num,total) num是一个随即数,total是总数( num / total ) * 的int类型可以计算百分比 '\r%d%%%s' % (rate_num ...

  2. emacs快捷键速记表

    纯手工打造,O(∩_∩)O哈哈~ * emacs快捷键速记表 ** 帮助*** C-h l 显示最后100个键入的内容*** C-h b 显示当前缓冲区所有可用的快捷键*** C-h t 打开emac ...

  3. 3. RNN神经网络-LSTM模型结构

    1. RNN神经网络模型原理 2. RNN神经网络模型的不同结构 3. RNN神经网络-LSTM模型结构 1. 前言 之前我们对RNN模型做了总结.由于RNN也有梯度消失的问题,因此很难处理长序列的数 ...

  4. MXNET:欠拟合、过拟合和模型选择

    当模型在训练数据集上更准确时,在测试数据集上的准确率既可能上升又可能下降.这是为什么呢? 训练误差和泛化误差 在解释上面提到的现象之前,我们需要区分训练误差(training error)和泛化误差( ...

  5. 【测量实战技术】Cad中导入坐标高程点并可以提取坐标带高程

    一般咱们都是导入cad的是坐标不带高程,那么怎么在cad中导入坐标高程的三维坐标呢,在不需要cass的情况下还能计算方量呢?而且还能批量提取出这些坐标高程的三维参数. 这些都是工作中非常常用的技能,不 ...

  6. Java知多少(93)鼠标事件

    鼠标事件的事件源往往与容器相关,当鼠标进入容器.离开容器,或者在容器中单击鼠标.拖动鼠标时都会发生鼠标事件.java语言为处理鼠标事件提供两个接口:MouseListener,MouseMotionL ...

  7. Ubuntu16.04搭建Postfix作为SMTP服务器

    一.DNS配置 类型 名称  值  TTL   A mail  128.199.254.32  1小时  MX  @ mail.example.com(优先:10) 1小时  TXT @  v=spf ...

  8. BigDecimal - Java精确运算

    (1).浮点数精确计算 项目中一直存在一个问题,就是每次报表统计的物资金额和实际的金额要差那么几分钱,和实际金额不一致,让客户觉得总是不那么舒服,原因是因为我们使用java的浮点类型double来定义 ...

  9. [Bayes] Parameter estimation by Sampling

    虽然openBugs效果不错,但原理是什么呢?需要感性认识,才能得其精髓. Recall [Bayes] prod: M-H: Independence Sampler firstly. 采样法 Re ...

  10. [IR] Arithmetic Coding

    Statistical methods的除了huffman外的另一种常见压缩方式. Huffman coding的非连续数值特性成为了无法达到香农极限的先天无法弥补的缺陷,但Arithmetic co ...