--- screen-4.0.3.org/screen.c	2013-09-24 14:07:50.595849001 +0000
+++ screen-4.0.3/screen.c	2013-09-24 14:36:40.817786893 +0000
@@ -1020,8 +1020,11 @@
   else
 #endif
     {
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	Panic(0, "You are not the owner of %s.", SockPath);
+#endif
     }
   if ((st.st_mode & 0777) != 0700)
     Panic(0, "Directory %s must have mode 700.", SockPath);
--- screen-4.2.1/socket.c
+++ screen-4.2.1-patched/socket.c
@@ -230,8 +230,11 @@
 #endif
 
       debug2("st.st_uid = %d, real_uid = %d\n", st.st_uid, real_uid);
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	continue;
+#endif
       mode = (int)st.st_mode & 0777;
       debug1("  has mode 0%03o\n", mode);
 #ifdef MULTIUSER 
@@ -450,8 +453,11 @@
       Msg(0, "There is already a screen running on %s.", Filename(SockPath));
       if (stat(SockPath, &st) == -1)
 	Panic(errno, "stat");
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if ((int)st.st_uid != real_uid)
 	Panic(0, "Unfortunately you are not its owner.");
+#endif
       if ((st.st_mode & 0700) == 0600)
 	Panic(0, "To resume it, use \"screen -r\"");
       else
@@ -542,8 +548,11 @@
       Msg(0, "There is already a screen running on %s.", Filename(SockPath));
       if (stat(SockPath, &st) == -1)
 	Panic(errno, "stat");
+#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME.
+                  in that case it does not make sense to compare uids. */
       if (st.st_uid != real_uid)
 	Panic(0, "Unfortunately you are not its owner.");
+#endif
       if ((st.st_mode & 0700) == 0600)
 	Panic(0, "To resume it, use \"screen -r\"");
       else
