From 3541c3a95386beecfd5724914d34ec78c8c5eac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hakan=20Bay=C4=B1nd=C4=B1r?= Date: Fri, 13 Feb 2015 01:14:34 +0200 Subject: [PATCH] Correct a misleading error message about folder permissions. --- README.md | 3 +++ smb-backup/smb-backup.sh | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ea2333..e3642dc 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,8 @@ In the beginning of the script, there is a configuration block. Set the remote I All pull requests and forks are very welcome. Thanks for taking a look! ## Changelog +### Version 1.1.1 +- Correct an error message about folder permissions to be more informative. + ### Version 1.1 - Detect writability of the backups folder in a better way using stat and by checking owner and permissions of the folder. diff --git a/smb-backup/smb-backup.sh b/smb-backup/smb-backup.sh index 26b61c3..5d2029e 100755 --- a/smb-backup/smb-backup.sh +++ b/smb-backup/smb-backup.sh @@ -60,7 +60,12 @@ fi folder_permissions=$(stat -c %a $backup_folder) if [ ${folder_permissions:0:1} != 7 ] then - echo "Folder $backup_folder is not writable, exiting." + # If the permissions is not the way we want, construct a human readable error message. + # recycle the variables in the process. + folder_permissions=$(stat -c %A $backup_folder) + folder_permissions=${folder_permissions:1:3} + + echo "Folder $backup_folder permissions for owner ("`stat -c %U $backup_folder`") is '$folder_permissions', not 'rwx', exiting." umount $temporary_mount_point rmdir $temporary_mount_point exit 1 -- 2.45.2