--- a/scripts/seafile.sh
+++ b/scripts/seafile.sh
@@ -42,10 +42,9 @@ fi
 function validate_running_user () {
     real_data_dir=`readlink -f ${default_seafile_data_dir}`
     running_user=`id -un`
-    data_dir_owner=`stat -c %U ${real_data_dir}`
 
-    if [[ "${running_user}" != "${data_dir_owner}" ]]; then
-        echo "Error: the user running the script (\"${running_user}\") is not the owner of \"${real_data_dir}\" folder, you should use the user \"${data_dir_owner}\" to run the script."
+    if [[ -z "$(find "${real_data_dir}" -user "${running_user}" -maxdepth 0)" ]]; then
+        echo "Error: the user running the script (\"${running_user}\") is not the owner of \"${real_data_dir}\" folder, you should use the owner of \"${real_data_dir}\" to run the script."
         exit -1;
     fi
 }
