Setting up the z/OS UNIX RSHD installation exit

When the -r option is enabled, if there is no password specified on the RSH command from the client, z/OS® UNIX RSHD will drive the installation exit. When the installation exit is driven, RSHD looks for a program in /usr/sbin named ruserok. This is the only name that it will look for. If /usr/sbin/ruserok is not found, the request will fail.

When the z/OS UNIX RSHD server invokes /user/sbin/ruserok, it will pass parameters in the following order:

  1. Host name or the host IP address
  2. Local user's UID
  3. Remote user ID
  4. Local user ID
If z/OS UNIX RSHD receives a return code of zero from the installation exit, z/OS UNIX RSHD continues. Any nonzero return code from the installation exit will cause RSHD to issue message EZYRS25E to the client and terminate all connections. The following code fragment can be used as an example to begin building a working ruserok installation exit:
int main(argc, argv)                                            
     int argc;                                                  
     char *argv[];                                               
  char *rhost1;    /* "hostname" or "hostname.domain" of client 
                      obtained by caller:                       
                      gethostbyaddr(getpeername()) or the host
                      ip address used by the gethostbyaddr if
                      it failed to return a "hostname" */   
  int locuid;      /* uid of the user name on local system */
  char *cliuname;  /* user name on client's system */           
  char *servuname; /* user name on this (server's) system */    
  int rc = 4;                                                   
                                                                
  rhost1 = argv[1];                                             
  locuid = atoi(argv[2]);                                       
  cliuname = argv[3];                                           
  servuname = argv[4];                                          
  .                                                             
  <authenticate user and set rc=0 if valid>
  .          
  return(rc);