I've got clamav installed on a headless Debian server. It is not running a mail-server so I do not have clamd (clamav-daemon) running. The server has a Samba share (/data) that various Windows 7 and Windows 10 boxes will be mapping.

There will be numerous Samba users and so the files/folders in /data will be owned by various accounts/groups.

There will be files/folders that the clamav account will not have permissions to read.

I want to create a daily cron job that will use clamscan to scan /data but I don't want to run clamscan as root because documentation and numerous articles says not to run ClamAV as root.

I have tested the scan by running clamscan as root so I know it works but not sure how to get it to work without running as root.

I'm not sure where to start or what to do. Any guidance is appreciated.


You can use sudo, like what is suggested by this answer. In this case, you can set the exact command to be run by the user.

You need the superuser access, as a user could have set a 700 permission, so that any other user cannot access to his files, unless they have superuser power.

Edit: Without root access / sudo, you can't have a full access to all files/directories, as users may change the group of the files and/or directories, and the permissions of them. In this case, a normal user can't access as it doesn't have the privilege, so it's not possible. Running clamav with sudo, though, allows you to run only clamav with full access (i.e. override the x00 permission access).

  • The question specifically asks about doing this without root privileges. (I don't think there's any way to do that, though.) – tripleee Mar 24 at 13:45
  • @tripleee yeah, I edited the question to add your point. Thanks – pittix Mar 24 at 14:53
  • Got it. Thanks! – IMTheNachoMan Mar 30 at 12:04

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.