11c3be
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
11c3be
index 22ea8ef..2660085 100644
11c3be
--- a/openbsd-compat/port-linux.c
11c3be
+++ b/openbsd-compat/port-linux.c
11c3be
@@ -116,7 +116,11 @@ ssh_selinux_setup_pty(char *pwname, const char *tty)
11c3be
 
11c3be
 	debug3("%s: setting TTY context on %s", __func__, tty);
11c3be
 
11c3be
-	user_ctx = ssh_selinux_getctxbyname(pwname);
11c3be
+	if (getexeccon(&user_ctx) != 0) {
11c3be
+		error("%s: getexeccon: %s", __func__, strerror(errno));
11c3be
+		goto out;
11c3be
+	}
11c3be
+
11c3be
 
11c3be
 	/* XXX: should these calls fatal() upon failure in enforcing mode? */
11c3be