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>
netapp::> set -privilege advanced
Warning: These advanced commands are potentially dangerous; use them only when directed to do so by NetApp
personnel.
Do you want to continue? {y|n}: y
netapp::*>
切り替える際、通常は「Do you want to continue? {y|n}: 」という確認プロンプトが出る。
これを出ないようにする方法がある
setコマンドをオプション無しで実行してみる
netapp::> set
User Name: admin
Profile Name: admin
Privilege Level: admin
Confirmation Messages: on
Show All Fields: false
Show Field Separator:
Data Units: auto
Pagination Rows: 24
Default Vserver:
Default Node:
Stop On Error: false
Prompt Timestamp:
netapp::>
netapp::> set -privilege advanced -confirmations off
netapp::*> set
User Name: admin
Profile Name: admin
Privilege Level: advanced
Confirmation Messages: off
Show All Fields: false
Show Field Separator:
Data Units: auto
Pagination Rows: 24
Default Vserver:
Default Node:
Stop On Error: false
Prompt Timestamp:
netapp::*>
netapp::> set -privilege advanced -confirmations off -rows 0;vserver cifs option show;set -privilege admin -confirmations on
Vserver: svm0
Client Session Timeout: 900
Copy Offload Enabled: true
Default Unix Group: -
Default Unix User: pcuser
Guest Unix User: -
Are Administrators mapped to 'root': true
Is Advanced Sparse File Support Enabled: true
Is Fsctl File Level Trim Enabled: true
Direct-Copy Copy Offload Enabled: true
Export Policies Enabled: false
Grant Unix Group Permissions to Others: false
Is Advertise DFS Enabled: false
Is Client Duplicate Session Detection Enabled: true
Is Client Version Reporting Enabled: true
Is DAC Enabled: false
Is Fake Open Support Enabled: true
Is Hide Dot Files Enabled: false
Is Large MTU Enabled: true
Is Local Auth Enabled: true
Is Local Users and Groups Enabled: true
Is Multichannel Enabled: false
Is NetBIOS over TCP (port 139) Enabled: true
Is NBNS over UDP (port 137) Enabled: false
Is Referral Enabled: false
Is Search Short Names Support Enabled: false
Is Trusted Domain Enumeration And Search Enabled: true
Is UNIX Extensions Enabled: false
Is Use Junction as Reparse Point Enabled: true
Max Multiplex Count: 255
Max Connections per Multichannel Session: 32
Max LIFs per Multichannel Session: 256
Max Same User Session Per Connection: 2500
Max Same Tree Connect Per Session: 5000
Max Opens Same File Per Tree: 1000
Max Watches Set Per Tree: 500
Is Path Component Cache Enabled: true
NT ACLs on UNIX Security Style Volumes Enabled: true
Read Grants Exec: disabled
Read Only Delete: disabled
Reported File System Sector Size: 4096
Restrict Anonymous: no-restriction
Shadowcopy Dir Depth: 5
Shadowcopy Enabled: true
SMB1 Enabled: false
Max Buffer Size for SMB1 Message: 65535
SMB2 Enabled: true
SMB3 Enabled: true
SMB3.1 Enabled: true
Map Null User to Windows User or Group: -
WINS Servers: -
Report Widelink as Reparse Point Versions: SMB1
Max Credits to Grant: 128
Check Share Permission for NetShareEnumAll Request: false
netapp::>