aboutsummaryrefslogtreecommitdiffstats
path: root/sshexec.1
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sshexec.1249
1 files changed, 233 insertions, 16 deletions
diff --git a/sshexec.1 b/sshexec.1
index 0dfe121..dc42392 100644
--- a/sshexec.1
+++ b/sshexec.1
@@ -8,9 +8,12 @@ sshexec - run a command through ssh(1) with normal command syntax
.RB [ {
.RI [\fBssh=\fP ssh-command ]
.RI [\fBdir=\fP directory ]
+.RB [ cd= ( strict | lax )]
.RB [[\fIfd\fP]{ > , >> , >| , < , <> }[ & ] = \fIfile\fP]
+.RB [ asis= \fIasis-marker\fP
+.RB [ nasis= \fIasis-count\fP]]
.BR } ]
-[ssh-option] ...\,
+.RI [ ssh-option ]\ ...\,
.I destination
.I command
.RI [ argument ]\ ...\,
@@ -20,18 +23,26 @@ The
.B sshexec
utility is a wrapper for SSH that makes it easy to run commands
directly in the SSH command.
-
+.PP
.B sshexec
passes any argument after
.B }
to
.I ssh-command
.RB ( ssh
-if not specified), and only modifies
+if not specified), but it
+rewrites
.I command
-.RB [ argument ]\ ...\,
-and inserts extra arguments after
+and the
+.IR argument s
+to one argument that can be passed into
+.BR ssh (1)
+to describe each argument as separate arguments.
+It may also rewrite
.I destination
+to remove information that's not supported by
+.BR ssh (1)
+and inserts extra arguments after it
(it may also add a
.B --
argument immediately before
@@ -99,6 +110,20 @@ In the remote, change working directory to
before executing
.IR command .
.TP
+.B cd=strict
+Fail without executing the
+.I command
+if it's not possible to set
+.I directory
+as the remote working directory.
+.TP
+.B cd=lax
+Continue (but warn) executing the
+.I command
+even if it's not possible to set
+.I directory
+as the remote working directory.
+.TP
.IB \fR[\fPfd\fP]\fP >= file
After changing working directory (assuming one is specified),
create or truncate the specified
@@ -183,19 +208,52 @@ Close the file descriptor
(Default
.I fd
is 0 (standard input).)
+.TP
+.BI asis= asis-marker
+Any
+.I argument
+equal to
+.I asis-marker
+will be skipped over and instead the next argument
+(regardless of whether it to is equal to
+.IR asis-marker )
+will be interpreted as raw shell code string that
+shall be inserted without escaping.
+.TP
+.BI masis= asis-count
+If specified,
+.I asis-marker
+shall only have it's specified affect up to
+.I asis-count
+times.
.SH OPERANDS
The following operands are supported:
.TP
.I destination
-This operand is passed as is (without validation) to the
-.BR ssh (1)
-utility. The
-.BR ssh (1)
-utility will expect it the be either in the form
-.RI [ user\fP\fB@ ] hostname
+The destination to connect and log into. It shall be either in
+the form
+.RI [ user\fP\fB@ ] hostname [\fB:\fP directory ]
or in the form
-.BR ssh:// [\fIuser @ ]\fIhostname\fP[ : \fIport\fP].
+.BR ssh [ exec ] :// [\fIuser @ ]\fIhostname\fP[ : \fIport\fP][ / \fIdirectory\fP].
+
+.I user
+shall be the name of the remote user. If not specified,
+the name of the local user running the utility will be used.
+
+.I hostname
+shall be the address to the remote machine.
+
+.I port
+shall be the port or service name for the port to
+connect to on the remote machine.
+
+.I directory
+shall be directory to change the remote working directory.
+This is an alternative to (with the exact same behaviour)
+to the
+.B dir
+option and cannot be combined with it.
.TP
.IR command \ [ argument ]\ ...\,
Whereas the
@@ -211,6 +269,12 @@ utility forces the remote shell to treat each of the
as separate arguments and cause the shell to executing
them as a non-builtin command.
+.I command
+must not contain an equals sign
+.RB ( = )
+or be just a dash
+.RB (\(dq - \(dq).
+
.SH STDIN
The
.B sshexec
@@ -223,7 +287,7 @@ None.
The following environment variables affects the execution of
.BR sshexec :
.TP
-.SH PATH
+.I PATH
Default. See to the Base Definitions volume of POSIX.1-2017, Section 8.3, Other Environment Variables.
This environment variable affects where the
.B sshexec
@@ -231,6 +295,156 @@ utility can find the
.BR ssh (1)
utility or
.IR ssh-command .
+.TP
+.I SSHEXEC_SSH
+If set and non-empty, it overrides the default value of
+.I ssh-command
+from
+.B ssh
+to the value of the variable.
+.TP
+.I SSHEXEC_OPTS_NO_ARG
+List of options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that do not have any argument.
+(Default is
+.BR 46AaCfGgKkMNnqsTtVvXxYy ,
+meaning the options
+.BR -4 ,
+.BR -6 ,
+.BR -A ,
+.BR -a ,
+.BR -C ,
+.BR -f ,
+.BR -G ,
+.BR -g ,
+.BR -K ,
+.BR -k ,
+.BR -M ,
+.BR -N ,
+.BR -n ,
+.BR -q ,
+.BR -s ,
+.BR -T ,
+.BR -t ,
+.BR -V ,
+.BR -v ,
+.BR -X ,
+.BR -x ,
+.BR -Y ,
+and
+.BR -y .)
+.TP
+.I SSHEXEC_OPTS_ARG
+List of options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that have an argument.
+(Default is
+.BR BbcDEeFIiJLlmOoPpQRSWw ,
+meaning the options
+.BR -B ,
+.BR -b ,
+.BR -c ,
+.BR -D ,
+.BR -E ,
+.BR -e ,
+.BR -F ,
+.BR -I ,
+.BR -i ,
+.BR -J ,
+.BR -L ,
+.BR -l ,
+.BR -m ,
+.BR -O ,
+.BR -o ,
+.BR -P ,
+.BR -p ,
+.BR -Q ,
+.BR -R ,
+.BR -S ,
+.BR -W ,
+and
+.BR -w .)
+.TP
+.I SSHEXEC_OPTS_OPT_ATTACHED_ARG
+List of options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that have an argument only if
+there are additional characters after
+the option character in the same
+command line argument. (Default is
+the empty string, meaning no options.)
+.TP
+.I SSHEXEC_OPTS_OPT_ARG
+List of options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that have an argument if there
+are additional characters after
+the option character in the same
+command line argument or if argument is
+followed directly by another argument
+which does not start with a dash
+.RB ( - ).
+(Default is
+the empty string, meaning no options.)
+.TP
+.I SSHEXEC_LONG_OPTS_NO_ARG
+Space-separated list of long options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that do not have any argument
+unless it is followed directly by an
+equals sign
+.RB ( = )
+in the same command line argument.
+Options that do not start with two dashes
+.RB ( -- )
+are silently ignored. (Default is the
+empty string, meaning no options.)
+.TP
+.I SSHEXEC_LONG_OPTS_ARG
+Space-separated list of long options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that have an argument that must
+either be specified in the next command
+line argument or after an
+equals sign
+.RB ( = )
+the shall directly follow the option
+string in the same command line argument.
+Options that do not start with two dashes
+.RB ( -- )
+are silently ignored. (Default is the
+empty string, meaning no options.)
+.TP
+.I SSHEXEC_LONG_OPTS_OPT_ARG
+Space-separated list of long options that
+.B sshexec
+shall interpret as
+.BR ssh (1)
+options that have an argument if it is
+the option string is is directly followed
+by equals sign
+.RB ( = )
+in the same command line argument or if
+argument is followed directly by another
+argument which does not start with a dash
+.RB ( - ).
+Options that do not start with two dashes
+.RB ( -- )
+are silently ignored. (Default is the
+empty string, meaning no options.)
.PP
Other environment variables may affect the execution of the
.BR ssh (1)
@@ -272,7 +486,9 @@ None.
None.
.SH RATIONALE
-None.
+The restrictions on
+.I command
+is in place to avoid unspecified behaviour.
.SH NOTES
None.
@@ -303,8 +519,9 @@ as special characters.
None.
.SH SEE ALSO
-.BR ssh (1)
+.BR ssh (1),
+.BR sshcd (1)
.SH AUTHORS
Mattias Andrée
-.RI < maandree@kth.se >
+.RI < m@maandree.se >