Minor code improvements in FileUtil and PasswordUtil

More elegant (and slightly more efficient) code in three functions + a function for formatted output of file permissions.