I am trying to access a file created by dumpcap application in ubuntu via Apache server. But it shows an error that 'Permission denied'.

After checking I found that the files are creating by the following permission mode 'rw-------'.

I tried the below ways, but could not solve the issue.

1. Set directory in dumpcap in which www-data user has access, but still all files are creating with this permission 'rw-------'.

2. Set all permissions to its parent directory recursively by the following command chmod -R 777 directory, but files creating in it are with the older permission .

Please can anyone suggest a way to get a solution for this?

  • Are you running dumpcap command yourself manually or is it automated? – Azamat Mar 7 '15 at 11:45
  • It is running as a subprocess from python script. – Binu Babu Mar 7 '15 at 11:58
  • well, you could probably run that python script as www-data user. – Azamat Mar 7 '15 at 12:01
  • We came across this idea but don't know how to run the script as www-data user.Please help. – Binu Babu Mar 7 '15 at 12:09

You stated in comments, that you have python script, that runs dumpcap command. Try running that python script as www-data user, like so:

sudo -u www-data [command/script to run]
| improve this answer | |
  • I tried using "sudo -u www-data dumpcap -D" but got an error that 'sudo: unable to execute/usr/bin/dumpcap: Permission denied'. – Binu Babu Mar 7 '15 at 12:55
  • Maybe you need to sudo chmod 755 /usr/bin/dumpcap and try running your command again. – Azamat Mar 7 '15 at 13:34
  • It is working now. I had to give permission for interfaces also. I run the following command also sudo setcap CAP_NET_RAW,CAP_NET_ADMIN,CAP_DAC_OVERRIDE+eip /usr/bin/dumpcap. Thank you Azamat. – Binu Babu Mar 7 '15 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.