aboutsummaryrefslogtreecommitdiffstats
path: root/sshcd.1
blob: d2a0265a9a2117fab24568284a47582a718330db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
.TH SSHCD 1 sshexec

.SH NAME
sshcd - open ssh(1) with a specific remote working directory

.SH SYNOPSIS
.B sshcd
.RB [ {
.RI [\fBssh=\fP ssh-command ]
.RB [ cd= ( strict | lax )]
.BR } ]
.RI [ ssh-option ]\ ...\,
.I destination

.SH DESCRIPTION
The
.B sshcd
utility is a wrapper for SSH that makes it lets the user
specify the directory remote working directory.
.PP
.B sshcd
passes any argument after
.B }
to
.I ssh-command
.RB ( ssh
if not specified), except it may rewrite
.I destination
to remove information that's not supported by
.BR ssh (1).

.SH OPTIONS
.B sshcd
options may be placed at the very beginning enclosed with
the arguments
.B {
and
.BR } .
.B sshcd
options, if any, shall be placed in the same
.B {
.BR } -group.
Any other option will be passed as is to the
.BR ssh (1)
utility or
.IR ssh-command .
The
.B sshcd
utility has a build it list of options recognised by the
.BR ssh (1)
utility and will not allow anything matching this list.
The
.B sshcd
utility does not allow mixing options and operands: no
option may be placed after
.IR destination .
.PP
The following
.B sshcd
options are supported:
.TP
.BI ssh= ssh-command
Instead of looking for
.B ssh
in
.IR PATH ,
the
.B sshcd
utility shall use
.IR ssh-command ,
which it will look for in
.I PATH
if it is only a file name (does not contain a slash
.RB ( / )).
.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.

.SH OPERANDS
The following operands are supported:
.TP
.I destination
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 [ cd ] :// [\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.

.SH STDIN
The
.B sshcd
utility itself does not use the standard input.

.SH INPUT FILES
None.

.SH ENVIRONMENT VARIABLES
The following environment variables affects the execution of
.BR sshcd :
.TP
.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 sshcd
utility can find the
.BR ssh (1)
utility or
.IR ssh-command .
.TP
.I SSHCD_PTY_ALLOC_FLAG
Specifies the option to pass to
.BR ssh (1)
to tell SSH to allocate a pseudo terminal. If unset
.B -t
will be used. If set but empty, no flag will be passed to
.BR ssh (1).
.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)
utility.

.SH ASYNCHRONOUS EVENTS
Default.

.SH STDOUT
The
.B sshcd
utility itself does not use the standard output.

.SH STDERR
The standard error is used for diagnostic messages in the
.B sshcd
utility itself.

.SH OUTPUT FILES
None.

.SH EXTENDED DESCRIPTION
None.

.SH EXIT STATUS
The
.B sshcd
utility exits with the exit status of the
.BR ssh (1)
utility or with 255 if an error occurred.

.SH CONSEQUENCES OF ERRORS
Default.

.SH APPLICATION USAGE
None.

.SH EXAMPLES
None.

.SH RATIONALE
For historical reasons, the
.B sshcd
utility does not let the user add a command to run
inside the directory. This also avoids problems; if the
user want to run a command in a specific directory,
.BR sshexec (1)
lets the user do so in an intuitive manner; for other
traditional syntax,
.BR ssh (1)
can still be used — specifying a
.BR cd (1)
command at the beginning shouldn't be a problem.

.SH NOTES
None.

.SH BUGS
None.

.SH FUTURE DIRECTIONS
None.

.SH SEE ALSO
.BR ssh (1),
.BR sshexec (1)

.SH AUTHORS
Mattias Andrée
.RI < m@maandree.se >