diff --git a/NEWS b/NEWS
index dbf28fe367acb67b29d50532ef68e9e773e8009e..6b99d33474c3d95fa0d6f7b1b6603121c0c2a21e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ documents those changes that are of interest to users and administrators.
 
 * Changes in Slurm 17.02.1
 ==========================
+ -- Modify pam module to work when configured NodeName and NodeHostname differ. 
 
 * Changes in Slurm 17.02.0
 ==========================
diff --git a/contribs/pam/README b/contribs/pam/README
index 62b266885328b56d8f26f1e87ee03686aa53ea04..93f6209276ed4bf40094144a818ddf4580289093 100644
--- a/contribs/pam/README
+++ b/contribs/pam/README
@@ -37,8 +37,7 @@ Description:
 Notes:
   This module will not work on systems where the hostname returned by the
      gethostname() differs from SLURM node name. This includes front-end
-     configurations (IBM BlueGene or Cray systems) or systems configured
-     in SLURM using the NodeHostName parameter.
+     configurations (IBM BlueGene or Cray/ALPS systems).
   rsh_kludge - The rsh service under RH71 (rsh-0.17-2.5) truncates the first
      character of this message.  The rsh client sends 3 NUL-terminated ASCII
      strings: client-user-name, server-user-name, and command string.  The
diff --git a/contribs/pam/pam_slurm.c b/contribs/pam/pam_slurm.c
index 0968a9c130ed089dc933988415615eae3e98e953..6131a01c3371cc8b18304e9c28896d4b72bea0ad 100644
--- a/contribs/pam/pam_slurm.c
+++ b/contribs/pam/pam_slurm.c
@@ -341,6 +341,20 @@ _slurm_match_allocation(uid_t uid)
 				     uid, nodename, j->job_id);
 				authorized = 1;
 				break;
+			} else {
+				char *nodename;
+				nodename = slurm_conf_get_nodename(hostname);
+				if (nodename) {
+					if (_hostrange_member(nodename,
+							      j->nodes)) {
+						DBG ("user %ld allocated node %s in job %ld",
+						     uid, nodename, j->job_id);
+						authorized = 1;
+						xfree(nodename);
+						break;
+					}
+					xfree(nodename);
+				}
 			}
 		}
 	}