Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My program needs to write in /var/log as well as /usr/lib including all the sub-folders in these directories.

How do I give permission for my program to do it?

share|improve this question

The only safe way of doing this would be to run your program as root. Any program that needs to write to system directories should be run as root anyway. A normal user has no business accessing those directories.

If your really, really want to make your system insecure you can look up SUID. Although, as explained here, you will have trouble setting SUID for scripts.

I really do not recommend this though. Seriously, just run your program as root. On a debian derived system (or any other that has sudo configured) do:

$ sudo your_program_name  

If sudo is not configured, do:

$ su
$ your_program_name 
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .