记录备忘!
使用tshark抓包时,出现以下异常:
Running as user “root” and group “root”. This could be dangerous.
Capturing on ‘enp3s0’
tshark: The file to which the capture would be saved (“tmp1/test.pcap”) could not be opened: Permission denied.
问题描述:
tshark抓包时必须以root身份运行,在普通用户模式下以sudo su 切换到root身份时,运行报错.
问题原因:
ls -lst 查看权限如下:
drwxr-xr-x 2 yk opuser 4096 Dec 4 16:53 tmp1
该目录的所有者并非root,也没有提供其他用户的使用权。修改目录权限使root拥有写入权限即可.
chmod o+w tmp1
权限不一定修改为o,同组时也可以使用g.
或者直接使用root身份创建目录.
如果是多级目录,只修改最下一级目录是不能解决问题的,必须将目标路径上的目录的权限全修改.
再次运行即可解决问题.