LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-05-2016, 03:53 PM   #1
PaxToYou
LQ Newbie
 
Registered: Oct 2016
Posts: 1

Rep: Reputation: Disabled
chmod +w /var/log/messages fails for root user? Why?


Does anybody know why the root user can add the read right for everybody to the /var/log/messages giving the commands:

$ ls -l /var/log/messages
-rw------- 1 root root 161613 Aug 8 14:12 /var/log/messages

$ chmod +r /var/log/messages

$ ls -l /var/log/messages
-rw-r--r-- 1 root root 161613 Aug 8 14:20 /var/log/messages

but with the same command can not add the write right

$ chmod +w /var/log/messages

$ ls -l /var/log/messages
-rw-r--r-- 1 root root 161613 Aug 8 14:20 /var/log/messages

Thank-you

-----------------
I've solved the problem with a 2 step procedure:
1) editing the /etc/syslog-ng/syslog-ng.conf file and adding into the option {….} block the line perm(0666);
2) rebooting the computer

Last edited by PaxToYou; 10-17-2016 at 04:51 PM. Reason: SOLUTION FOUND
 
Old 10-06-2016, 02:43 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi and welcome to LQ,

From the chmod manpage:
Quote:
A combination of the letters ugoa controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in the file's group (o), or all users (a). If none of these are given, the effect is as if (a) were given, but bits that are set in the umask are not affected.
The (default) umask for file creation is 0022, meaning that the write bit (w) is set for group and others so chmod will ignore it according to the above.

If you are sure you want to change the file, use either one of the following:
Code:
chmod a+w /var/log/messages
chmod 666 /var/log/messages
Regards
 
Old 10-06-2016, 04:35 PM   #3
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
Not sure if it's even a wise idea to let ordinary users be able to write to system log a la tmp directory?
 
Old 10-09-2016, 01:52 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
http://xyproblem.info/

https://www.google.com/#q=sudo%20you...g%20it%20wrong
 
1 members found this post helpful.
Old 11-30-2016, 10:06 PM   #5
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
I don't believe it is AT ALL WISE to allow ordinary users write permissions on a system log file. It can then be altered at will, possibly maliciously, and even benign changes to it by a user might totally break new valid system entries.

That said, logrotate will likely change its permissions back to the default each time it runs.
 
  


Reply



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
[SOLVED] "systemd: Started Session ### of user root" in /var/log/messages thealmightyos Linux - Security 4 03-22-2017 04:29 PM
[SOLVED] Central log server aggregating all messages to /var/log/messages lhiggie1 CentOS 6 01-20-2015 04:44 PM
[SOLVED] No /var/log/messages , syslog , kern.log -but cat /var/spool/octopussy/octo_fifo masuch Linux - Newbie 4 06-13-2012 08:05 PM
Getting strange user names in /var/log/messages. stf92 Linux - Newbie 19 05-26-2009 11:02 AM
User session opened and closed msg in /var/log/messages andiramesh Linux - Newbie 9 09-05-2008 05:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:27 PM.

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