Re: SSH commands to ONTAP 9.11.1P11 failing from within script

jordan slingerland <[email protected]> Tue, 3 Oct 2023 21:28:14 -0400
Newsgroups gmane.comp.hardware.netapp
Message-ID <CAL=8eeLApA6asxTnPUo95-9scQ=5FjAL23x3c=D+W5F-MavB0A@mail.gmail.com>
--===============1706293460355478794==
Content-Type: multipart/alternative; boundary="0000000000005c006a0606d9ec1c"

--0000000000005c006a0606d9ec1c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The backticks are being interpreted by the local shell as as a command and
the input between the ticks is being sent as the output of that command.
Which is unknown command.

On Mon, Oct 2, 2023, 1:05 PM Davis, Kevin <[email protected]>
wrote:

> Folks something tells me this is going to be a "D'Oh!" moment, but I'm
> baffled.
>
> I had a simple requirement to support an ongoing project that requires th=
e
> creation of a snapshot, and a CIFS share referencing that snapshot, over =
a
> series of days. Snapshot and share name naming convention is a simple
> <YYYYmmdd-<string> and <YYYYmmdd-<string>$> respectively.
> The intention is to create both snapshot/share a little after midnight
> each day until the project ends and they are no longer needed. Simple
> enough, right?
> Well, when I run these commands via SSH from a prompt on a Linux box,
> everything works just fine:
> [root@foo01 ~]# /bin/ssh admin@foo'snapshot create -vserver foo3 -volume
> Foo04 -snapshot 20231003-foo -expiry-time 11/02/2023 00:00:00'
>
> Last login time: 10/2/2023 12:26:31
>
> [root@foo01 ~]# /bin/ssh admin@foo 'snapshot show -vserver foo3 -volume
> Foo04 -snapshot 20231003-foo '
>
> Last login time: 10/2/2023 12:46:12
>
>                               Vserver: foo3
>                                Volume: Foo04
>                              Snapshot: 20231003-foo
>                         Creation Time: Mon Oct 02 12:46:13 2023
>                         Snapshot Busy: false
>                        List of Owners: -
>                         Snapshot Size: 14.76MB
>            Percentage of Total Blocks: 0%
>             Percentage of Used Blocks: 0%
>                               Comment: -
>                       7-Mode Snapshot: false
>       Label for SnapMirror Operations: -
>                        Snapshot State: -
>                  Constituent Snapshot: false
>                           Expiry Time: 11/2/2023 00:00:00
>                  SnapLock Expiry Time: -
>
> However, running a script (sh or bash, makes no difference in this case),
> I get this when it runs. It actually doesn't matter what ONTAP command I
> send, they all give the same "Vserver name: Invalid." error (the /bin/ssh=
=E2=80=8B
> lines are just echo statements in the script so I can see that it's
> building and sending the right command line):
>
> /bin/ssh admin@foo 'snapshot create -vserver foo3 -volume Foo04 -snapshot
> 20231003-foo -expiry-time 11/02/2023 00:00:00'
>
> Last login time: 10/2/2023 12:46:39
>
> Error: Vserver name: Invalid. The Vserver name must begin with a letter o=
r
> an
>        underscore. Maximum supported length: 41 if Vserver is type
>        "sync-source", 47 otherwise.
>
> /bin/ssh admin@foo 'cifs share create -vserver foo3 -path
> /Foo04/.snapshot/20231003-foo -share-name 20231003-foo$ -share-properties
> oplocks,browsable,changenotify,show-previous-versions -symlink-properties
> symlinks -offline-files manual -vscan-fileop-profile standard
> -max-connections-per-share 4294967295 -comment pst migrations ok to delet=
e
> after 11/02/2023 00:00:00'
>
> Last login time: 10/2/2023 12:51:11
>
> Error: Vserver name: Invalid. The Vserver name must begin with a letter o=
r
> an
>        underscore. Maximum supported length: 41 if Vserver is type
>        "sync-source", 47 otherwise.
>
> The script is so simple it's embarrassing. Define a few variables and
> optargs, build 3 simple SSH commands to send to the toaster, and run them=
.
> Everything up until these commands reach the toaster is working as
> expected.  It just breaks when it gets there.
>
>
>
>
> --
>
> Kevin Davis
>
> Systems Administration | Sr. Storage Engineer | Information Services
>
> UMass Memorial Health | 100 Front St. Fl 1, Worcester, MA 01608 | mailto:
> [email protected]
>
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material. Any review, transmission, re-transmission, dissemination or oth=
er
> use of, or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is prohibited. If y=
ou
> received this in error, please contact the sender and delete the material
> from any computer.
> _______________________________________________
> Toasters mailing list
> [email protected]
> https://www.teaparty.net/mailman/listinfo/toasters

--0000000000005c006a0606d9ec1c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div>The backticks are being interpreted by the local she=
ll as as a command and the input between the ticks is being sent as the out=
put of that command. Which is unknown command.=C2=A0<br><br><div class=3D"g=
mail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 2, 2023, 1:05=
 PM Davis, Kevin &lt;<a href=3D"mailto:[email protected]">Kevin=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">




<div dir=3D"ltr">
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
Folks something tells me this is going to be a &quot;D&#39;Oh!&quot; moment=
, but I&#39;m baffled.</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<br>
</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
I had a simple requirement to support an ongoing project that requires the =
creation of a snapshot, and a CIFS share referencing that snapshot, over a =
series of days. Snapshot and share name naming convention is a simple &lt;Y=
YYYmmdd-&lt;string&gt; and &lt;YYYYmmdd-&lt;string&gt;$&gt;
 respectively.</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
The intention is to create both snapshot/share a little after midnight each=
 day until the project ends and they are no longer needed. Simple enough, r=
ight?</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
Well, when I run these commands via SSH from a prompt on a Linux box, every=
thing works just fine:</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<span style=3D"font-family:&quot;Courier New&quot;,monospace">[root@foo01 ~=
]# /bin/ssh admin@foo&#39;snapshot create -vserver foo3 -volume Foo04 -snap=
shot 20231003-foo -expiry-time 11/02/2023 00:00:00&#39;</span></div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Last log=
in time: 10/2/2023 12:26:31</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">[root@fo=
o01 ~]# /bin/ssh admin@foo &#39;snapshot show -vserver foo3 -volume Foo04 -=
snapshot 20231003-foo &#39;</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Last log=
in time: 10/2/2023 12:46:12</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 Vserver: foo3</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume: Foo04</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0Snapshot: 20231003-foo</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 Creation Time: Mon Oct 02 12:46:13 2023</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 Snapshot Busy: false</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0List of Owners: -</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 Snapshot Size: 14.76MB</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Percentage of Total Blocks: 0%</span></di=
v>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Percentage of Used Blocks: 0%</span></di=
v>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 Comment: -</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 7-Mod=
e Snapshot: false</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 Label for SnapMirror Operations: -</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0Snapshot State: -</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Constituent Snapshot=
: false</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 Expiry Time: 11/2/2023 00:00:00</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SnapLock Expiry Time=
: -</span></div>
<div><br>
</div>
However, running a script (sh or bash, makes no difference in this case), I=
 get this when it runs. It actually doesn&#39;t matter what ONTAP command I=
 send, they all give the same &quot;Vserver name: Invalid.&quot; error (the
<code>/bin/ssh</code>=E2=80=8B lines are just echo statements in the script=
 so I can see that it&#39;s building and sending the right command line):</=
div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<br>
</div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<span style=3D"font-family:&quot;Courier New&quot;,monospace"></span><span =
style=3D"font-family:&quot;Courier New&quot;,monospace">/bin/ssh admin@foo =
&#39;snapshot create -vserver foo3 -volume Foo04 -snapshot 20231003-foo -ex=
piry-time 11/02/2023 00:00:00&#39;</span>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Last log=
in time: 10/2/2023 12:46:39</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Error: V=
server name: Invalid. The Vserver name must begin with a letter or an</span=
></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0underscore. Maximum supported length: 41 if Vserver is =
type</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0&quot;sync-source&quot;, 47 otherwise.</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">/bin/ssh=
 admin@foo &#39;cifs share create -vserver foo3 -path /Foo04/.snapshot/2023=
1003-foo -share-name 20231003-foo$ -share-properties oplocks,browsable,chan=
genotify,show-previous-versions -symlink-properties
 symlinks -offline-files manual -vscan-fileop-profile standard -max-connect=
ions-per-share 4294967295 -comment pst migrations ok to delete after 11/02/=
2023 00:00:00&#39;</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Last log=
in time: 10/2/2023 12:51:11</span></div>
<div><br>
</div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">Error: V=
server name: Invalid. The Vserver name must begin with a letter or an</span=
></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0underscore. Maximum supported length: 41 if Vserver is =
type</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0&quot;sync-source&quot;, 47 otherwise.</span></div>
<div><span style=3D"font-family:&quot;Courier New&quot;,monospace"></span><=
/div>
<div><br>
</div>
The script is so simple it&#39;s embarrassing. Define a few variables and o=
ptargs, build 3 simple SSH commands to send to the toaster, and run them. E=
verything up until these commands reach the toaster is working as expected.=
=C2=A0 It just breaks when it gets there.=C2=A0=C2=A0</div>
<div>
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<br>
</div>
<div id=3D"m_-1402608523117809444Signature">
<div style=3D"font-family:&quot;Lucida Sans Unicode&quot;,&quot;Lucida Gran=
de&quot;,sans-serif;font-size:11pt;color:rgb(0,0,0);background-color:rgb(25=
5,255,255)">
<br>
</div>
<div style=3D"font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt=
;color:rgb(0,0,0)">
<p style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans=
-serif">
<span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)">=
=C2=A0</span></p>
<p style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans=
-serif">
<span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)">--=
 =C2=A0</span></p>
<p style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans=
-serif">
<span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)">Ke=
vin Davis=C2=A0</span></p>
<p style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans=
-serif">
<span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)">Sy=
stems Administration | Sr. Storage Engineer | Information Services=C2=A0</s=
pan></p>
<p style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans=
-serif">
<span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)">UM=
ass Memorial Health | 100 Front St. Fl 1, Worcester, MA 01608</span><i styl=
e=3D"font-family:&quot;Courier New&quot;;font-size:inherit;font-variant-lig=
atures:inherit;font-variant-caps:inherit;font-weight:inherit;color:rgb(31,7=
3,125)">=C2=A0</i><span style=3D"font-family:&quot;Courier New&quot;;color:=
rgb(31,73,125)">|</span><i style=3D"font-family:&quot;Courier New&quot;;fon=
t-size:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;fon=
t-weight:inherit;color:rgb(31,73,125)">
</i><span style=3D"font-family:&quot;Courier New&quot;;color:rgb(31,73,125)=
">mailto:<a href=3D"mailto:[email protected]" target=3D"_blank"=
 rel=3D"noreferrer">[email protected]</a></span><i style=3D"fon=
t-family:&quot;Courier New&quot;;font-size:inherit;font-variant-ligatures:i=
nherit;font-variant-caps:inherit;font-weight:inherit;color:rgb(31,73,125)">=
=C2=A0</i></p>
<br>
<br>
</div>
</div>
</div>
The information transmitted is intended only for the person or entity to wh=
ich it is addressed and may contain confidential and/or privileged material=
. Any review, transmission, re-transmission, dissemination or other use of,=
 or taking of any action in reliance
 upon this information by persons or entities other than the intended recip=
ient is prohibited. If you received this in error, please contact the sende=
r and delete the material from any computer.
</div>

_______________________________________________<br>
Toasters mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank" rel=3D"noreferre=
r">[email protected]</a><br>
<a href=3D"https://www.teaparty.net/mailman/listinfo/toasters" rel=3D"noref=
errer noreferrer" target=3D"_blank">https://www.teaparty.net/mailman/listin=
fo/toasters</a></blockquote></div></div></div>

--0000000000005c006a0606d9ec1c--

--===============1706293460355478794==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Toasters mailing list
[email protected]
https://www.teaparty.net/mailman/listinfo/toasters
--===============1706293460355478794==--