title: change linux socket file permissions
body: <p>First, yes this is related to <a href="https://stackoverflow.com/questions/5977556/how-can-i-change-the-permissions-of-a-linux-socket-file">this stack overflow question</a>, but I'm having a slightly different set of circumstances and my post there is not getting an answer.</p>
  
  <p>So, on my Dell desktop workstation, Ubuntu 10.04 32 bit, I have developed a server program that is designed to offer a Unix-Domain socket to a PHP "program" run by Apache.  (note:  umask = 0022) I named the socket file /home/wmiller/ACT/web_socket_file.  (ACT is a reference to the product name).  /home/wmiller/ACT has permissions of 777.  /home/wmiller/ACT/web_socket_file gets created with permissions of 777.</p>
  
  <p>Now, I copy the program to my test platform, a Q7 format Intel processor board, which also has Ubuntu 10.04 32 bit and umask = 0022.  Same directories, same 777 permission on the dir.  However, now when i run the code /home/wmiller/ACT/web_socket_file comes up with 755 permissions and Apache/PHP can't open the Unix Domain socket because it gets r-x permissions instead of rw- or rwx.  Apache is running in uid = www-data.</p>
  
  <pre><code>sockaddr_un       webServAddr;
  remove( g_webSocketFileName.c_str() );       // to erase any lingering file from last time
  
  memset(&amp;webServAddr, 0, sizeof(webServAddr));
  webServAddr.sun_family        = AF_UNIX;
  snprintf( webServAddr.sun_path, UNIX_PATH_MAX, "%s", g_webSocketFileName.c_str() );
  
  if (( g_webServerSock = socket(AF_UNIX, SOCK_STREAM, 0)) &lt; 0 )
  {
      PLOG( ERROR ) &lt;&lt; "Failed to acquire the web Server socket: ";  // uses google glog tool
      return -1;
  }
  </code></pre>
  
  <p>So I tried both of these and neither worked.</p>
  
  <pre><code>chmod( g_webSocketFileName.c_str(), S_IRWXU | S_IRWXG  | S_IRWXO );
  </code></pre>
  
  <p>and</p>
  
  <pre><code>char temp[100];
  sprintf( temp , "chmod o+w %s\n", g_webSocketFileName.c_str() );
  system( temp );
  </code></pre>
  
  <p>Tried permissions of 777 and o+w.</p>
  
  <p>I even tried adding a </p>
  
  <pre><code>unlink( g_webSocketFileName.c_str() );
  </code></pre>
  
  <p>But no help there.</p>
  
  <p>Anyone have suggestions on why ir works on one machine and not on another almost identical machine?
  Would I be better off to put the socket file elsewhere?  Is there a standard place-where-socket-files-go?</p>