From 8c3cfe97f3661bea6bacc16e710e56a56a1bf546 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Thu, 4 Feb 2016 13:50:36 +0100 Subject: [PATCH] marsadm: show wrong permissions Feature request by Tilmann Steinberg. It greatly eases debugging when searching for a source of wrong permissions. Some admin tools like Puppet seem to have their own default notion of "secure permissions" and try to "fix" them ;) --- userspace/marsadm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/userspace/marsadm b/userspace/marsadm index 639feda6..c659a037 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -5087,8 +5087,10 @@ if ($mars_stat[4]) { lwarn "Fixed by setting to 0.\n"; } # check permissions -if ($mars_stat[2] & 077777 != 0700) { - lwarn "Directory $mars has wrong permissions.\n"; +my $perms = ($mars_stat[2] & 07777); +if ($perms != 0700) { + my $txt = sprintf("Directory $mars has wrong permissions 0%o.\n", $perms); + lwarn($txt); chmod(0700, $mars) or ldie "Cannot chmod $mars.\n"; lwarn "Fixed to mode 0700 for security reasons.\n"; }