{"id":5043,"date":"2024-03-04T14:40:28","date_gmt":"2024-03-04T22:40:28","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=5043"},"modified":"2024-03-04T14:41:08","modified_gmt":"2024-03-04T22:41:08","slug":"how-to-change-default-permissions-of-var-log-on-linux","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=5043","title":{"rendered":"How to Change Default Permissions of \/var\/log on Linux"},"content":{"rendered":"\n<p>By default, \/var\/log\/messages* are created with&nbsp;<strong>read-write permissions for &#8216;root&#8217; user only<\/strong>. There might be a requirement to make the log files world readable for eg to allow an application to read and process the data in it.<\/p>\n\n\n\n<p>It is best to only change $umask once and use $FileCreateMode instead to change the mode.<\/p>\n\n\n\n<p>Add the $umask near the top of the configuration file, such as at the top of the <strong>GLOBAL DIRECTIVES <\/strong>section of \/etc\/rsyslog.conf. Make sure it is set before any $IncludeConfig directives. Use $umask 0022 to stop files from being able to be written to by anyone, or $umask 0000 to remove all restrictions for $FileCreateMode. GLOBAL DIRECTIVES<\/p>\n\n\n\n<p><strong><em>$umask 0022<\/em><\/strong><\/p>\n\n\n\n<p>Set $FileCreateMode right before the rule that creates the file. It might look something like shown below.<\/p>\n\n\n\n<p><strong>$FileCreateMode 0644<\/strong><br>*.info;mail.none;authpriv.none;cron.none \/var\/log\/messages<\/p>\n\n\n\n<p># The authpriv file has restricted access.<br><strong>$FileCreateMode 0600<\/strong><br>authpriv.* \/var\/log\/secure<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, \/var\/log\/messages* are created with&nbsp;read-write permissions for &#8216;root&#8217; user only. There might be a requirement to make the log files world readable for eg to allow an application to read and process the data in it. It is best to only change $umask once and use $FileCreateMode instead to change the mode. Add the <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=5043\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[262,5],"tags":[1769,1768],"class_list":["post-5043","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","tag-change-default-permissions-var-log-messages","tag-change-default-permissions-of-var-log"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5043"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5043\/revisions"}],"predecessor-version":[{"id":5045,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/5043\/revisions\/5045"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}