LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Access to /var/log/messages (https://www.linuxquestions.org/questions/linux-software-2/access-to-var-log-messages-425362/)

roniagmon 03-16-2006 08:23 AM

Access to /var/log/messages
 
I want to write an application that gets, periodically, the new messages written to /var/log/messages (and other log files in the same directory). I want the application to run in user mode. The problem is that this file can be opened only in su mode.
Is there any system call (or another option) that gets the new messages in user mode ?
Regards

pixellany 03-16-2006 08:31 AM

You can create a script that runs as root (aka "in su mode")--or you can change the permissions on the file in question.

roniagmon 03-17-2006 07:54 AM

I tried it and it works
Thanks

roniagmon 03-19-2006 01:49 AM

I can't change file permission
 
It appears that I can't change the permissions of files in /var/log. I prefer not to write any script (or small program) in root mode so I tried to use the system call syslog (syslog(3, bufp, len) but it returned always 0 bytes. I tried it as a root and as a user (though in the man page it is written that syslog(3, ...) can be activated also in user mode).
Should I do any other action besides calling to this system call ? Is there another system call that can be used in user mode ?

rickh 03-19-2006 01:55 AM

In Debian, if you add a user to group: adm, they have read access to /var/log files


All times are GMT -5. The time now is 04:03 PM.