PS C:\Users\Administrator> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):
Created directory 'C:\Users\Administrator/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Eomw4OJ5tGv2Nx0HkGCeaRT5PxBU3krAixd96aCIkJU administrator@WindowsServer
The key's randomart image is:
+---[RSA 2048]----+
|. +..=*o+. . |
|.+ E+ooBoo.o |
|..o.o=* *o+. |
|o o.oo B.... |
| o o o S.. |
| . . . + . |
| + . + |
| o . o . |
| .. . |
+----[SHA256]-----+
PS C:\Users\Administrator>
netapp::> security login create -user admin -application ssh -authentication-method publickey -role admin
Warning: To use public-key authentication, you must create a public key for user "admin".
netapp::>
上記で警告が出ていますが、これは現状該当するユーザ用の公開鍵が登録されていないためのものです。
再度「security login show -vserver クラスタ名」を実行すると、publickeyの登録が増えていることが確認出来ます。
netapp::> security login show -vserver netapp
Vserver: netapp
Second
User/Group Authentication Acct Authentication
Name Application Method Role Name Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
admin console password admin no none
admin http password admin no none
admin ontapi password admin no none
admin service-processor
password admin no none
admin ssh password admin no none
admin ssh publickey admin - none
autosupport console password autosupport no none
7 entries were displayed.
netapp::>
PS C:\Users\Administrator> ssh admin@172.17.44.55 "system node show"
The authenticity of host '172.17.44.55 (172.17.44.55)' can't be established.
ECDSA key fingerprint is SHA256:Hx4oFf3c4GUnc/HxpK4X1U6Um7M2a+hG4JdUAtFi4Hc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.17.44.55' (ECDSA) to the list of known hosts.
Last login time: 12/13/2022 18:31:20
Node Health Eligibility Uptime Model Owner Location
--------- ------ ----------- ------------- ----------- -------- ---------------
netapp-01 true true 1 days 07:30 SIMBOX
PS C:\Users\Administrator> ssh admin@172.17.44.55 "system node show"
Last login time: 12/13/2022 18:55:35
Node Health Eligibility Uptime Model Owner Location
--------- ------ ----------- ------------- ----------- -------- ---------------
netapp-01 true true 1 days 07:30 SIMBOX
PS C:\Users\Administrator>
@echo off
ssh admin@172.17.44.55 "date" >> c:\tmp\command.txt
これをタスクスケジューラに登録してログアウト。
指定時間経過後にファイルを確認してみます。
PS C:\Users\Administrator> type C:\tmp\command.txt
Last login time: 12/13/2022 19:00:13
Node Date Time zone
--------- ------------------------ -------------------------
netapp-01
Tue Dec 13 19:05:11 2022 Japan
PS C:\Users\Administrator>