-/* $OpenBSD: readconf.c,v 1.395 2025/02/15 01:48:30 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.396 2025/02/15 01:50:47 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
match_pattern_list(criteria, arg, 0) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
+ } else if (strcasecmp(attrib, "sessiontype") == 0) {
+ if (options->session_type == SESSION_TYPE_SUBSYSTEM)
+ criteria = xstrdup("subsystem");
+ else if (options->session_type == SESSION_TYPE_NONE)
+ criteria = xstrdup("none");
+ else if (remote_command != NULL &&
+ *remote_command != '\0')
+ criteria = xstrdup("exec");
+ else
+ criteria = xstrdup("shell");
+ r = match_pattern_list(criteria, arg, 0) == 1;
+ if (r == (negate ? 1 : 0))
+ this_result = result = 0;
} else if (strcasecmp(attrib, "exec") == 0) {
if ((cmd = expand_match_exec_or_include_path(arg,
options, pw, host_arg, original_host,
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: ssh_config.5,v 1.408 2025/02/15 01:48:30 djm Exp $
+.\" $OpenBSD: ssh_config.5,v 1.409 2025/02/15 01:50:47 djm Exp $
.Dd $Mdocdate: February 15 2025 $
.Dt SSH_CONFIG 5
.Os
(this keyword may be useful in system-wide
.Nm
files).
+.Pp
+Finally, the
+.Cm sessiontype
+keyword matches the requested session type, which may be one of
+.Cm shell
+for interactive sessions,
+.Cm exec
+for command execution sessions,
+.Cm subsystem
+for subsystem invocations such as
+.Xr sftp 1 ,
+or
+.Cm none
+for transport-only sessions, such as when
+.Xr ssh 1
+is started with the
+.Fl N
+flag.
.It Cm AddKeysToAgent
Specifies whether keys should be automatically added to a running
.Xr ssh-agent 1 .