f5835d
diff --git a/authfile.c b/authfile.c
f5835d
index e93d867..4fc5b3d 100644
f5835d
--- a/authfile.c
f5835d
+++ b/authfile.c
f5835d
@@ -32,6 +32,7 @@
f5835d
 
f5835d
 #include <errno.h>
f5835d
 #include <fcntl.h>
f5835d
+#include <grp.h>
f5835d
 #include <stdio.h>
f5835d
 #include <stdarg.h>
f5835d
 #include <stdlib.h>
f5835d
@@ -207,6 +208,13 @@ sshkey_perm_ok(int fd, const char *filename)
f5835d
 #ifdef HAVE_CYGWIN
f5835d
 	if (check_ntsec(filename))
f5835d
 #endif
f5835d
+	if (st.st_mode & 040) {
f5835d
+		struct group *gr;
f5835d
+
f5835d
+		if ((gr = getgrnam("ssh_keys")) && (st.st_gid == gr->gr_gid))
f5835d
+			st.st_mode &= ~040;
f5835d
+	}
f5835d
+
f5835d
 	if ((st.st_uid == getuid()) && (st.st_mode & 077) != 0) {
f5835d
 		error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
f5835d
 		error("@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @");