diff --git a/PAM.py b/PAM.py
index <HASH>..<HASH> 100644
--- a/PAM.py
+++ b/PAM.py
@@ -163,6 +163,7 @@ PAM_TTY = 3
 PAM_USER = 2
 PAM_USER_PROMPT = 9
 PAM_USER_UNKNOWN = 10
+PAM_XDISPLAY = 11
 
 
 class error(Exception):  # noqa: N801
@@ -282,7 +283,7 @@ class pam(object):  # noqa: N801
 				self.user = item
 			elif item_type == PAM_SERVICE:
 				self.service = item
-			elif item_type not in (PAM_TTY,):
+			elif item_type not in (PAM_TTY, PAM_XDISPLAY):
 				raise TypeError("bad parameter")
 			item = c_char_p(self.__securestring(item))
 		retval = pam_set_item(self.pamh, int(item_type), cast(item, c_void_p))
diff --git a/pam.py b/pam.py
index <HASH>..<HASH> 100644
--- a/pam.py
+++ b/pam.py
@@ -96,6 +96,7 @@ class pam():
 
         # set the TTY, needed when pam_securetty is used and the username root is used
         p.set_item(PAM.PAM_TTY, ctty)
+        p.set_item(PAM.PAM_XDISPLAY, ctty)
         try:
             p.authenticate()
             p.acct_mgmt()
Add PAM_XDISPLAY