Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-16-2006, 08:23 AM   #1
LQ Newbie
Registered: Mar 2006
Posts: 3

Rep: Reputation: 0
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 ?
Old 03-16-2006, 08:31 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734Reputation: 734
You can create a script that runs as root (aka "in su mode")--or you can change the permissions on the file in question.
Old 03-17-2006, 07:54 AM   #3
LQ Newbie
Registered: Mar 2006
Posts: 3

Original Poster
Rep: Reputation: 0
I tried it and it works
Old 03-19-2006, 01:49 AM   #4
LQ Newbie
Registered: Mar 2006
Posts: 3

Original Poster
Rep: Reputation: 0
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 ?
Old 03-19-2006, 01:55 AM   #5
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeating messages in /var/log/messages skubik Linux - General 2 12-23-2005 03:47 PM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
From where am i getting error messages to /var/log/messages? prabhuacsp Programming 3 02-16-2005 08:59 AM
From where am i getting error messages to /var/log/messages? prabhuacsp Linux - Networking 1 02-16-2005 12:34 AM
/var/log/messages full of these messages. Should I be concerned? mdavis Linux - Security 5 04-16-2004 10:08 AM

All times are GMT -5. The time now is 08:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration