HP 3PAR StoreServ 7400 2-node HP 3PAR Command Line Interface Administrator& - Page 56

script is run. To decrypt the private key, run

Page 56 highlights

The ssh-keygen utility generates two files: id_rsa.pub and id_rsa.pub (or id_dsa.pub and id_dsa.pub). • Generate the key with or without a pass phrase. ◦ When the key is generated with a pass phrase, your private key is encrypted and stored in the file. NOTE: The pass phrase must be entered and the private key decrypted before a script is run. To decrypt the private key, run the ssh-agent and ssh-add commands (see Step 6). ◦ When a pass phrase is not specified, the key is stored unencrypted in the file. • Ensure that only the owner has access and read/write permission on the private key file, otherwise the SSH client refuses the key file. 3. Log in to a system from any system with the SSH client installed. $ssh user3@system1 user3@system1's password: testpw3 4. Issue the setsshkey command. system1 cli% setsshkey setsshkey Please enter the SSH public key below. When finished, press enter twice. The key is usually long. It's better to copy it from inside an editor and paste it here. (Please make sure there is no extra blanks.) ssh-rsa AF5afPdciUTJ0PYzB6msRxFrCuDSqDwPshqWS5tGCFSoSZdE= user3's pubic key SSH public key successfully set! 5. Write your script. See the following example: #!/bin/sh # Assume that the user name "user3" exists on system1 # The private key file "id_rsa" is accessible. SSH="ssh -i id_rsa -l user3 system1 " # # Execute the command passed in as command line argument $1 ${SSH} $1 56 Running the HP 3PAR Command Line Interface

  • 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

The
ssh–keygen
utility generates two files:
id_rsa.pub
and
id_rsa.pub
(or
id_dsa.pub
and
id_dsa.pub
).
Generate the key with or without a pass phrase.
When the key is generated with a pass phrase, your private key is encrypted and
stored in the file.
NOTE:
The pass phrase must be entered and the private key decrypted before a
script is run. To decrypt the private key, run the
ssh
agent
and
ssh
add
commands
(see
Step 6
).
When a pass phrase is not specified, the key is stored unencrypted in the file.
Ensure that only the owner has access and read/write permission on the private key file,
otherwise the SSH client refuses the key file.
3.
Log in to a system from any system with the SSH client installed.
$ssh user3@system1
user3@system1
s password: testpw3
4.
Issue the
setsshkey
command.
system1 cli% setsshkey
setsshkey
Please enter the SSH public key below.
When finished, press enter twice.
The
key is usually long.
It's better to copy it from inside an editor and paste it
here.
(Please make sure there is no extra blanks.)
ssh
rsa AF5afPdciUTJ0PYzB6msRxFrCuDSqDwPshqWS5tGCFSoSZdE= user3
s pubic key
SSH public key successfully set!
5.
Write your script. See the following example:
#!/bin/sh
# Assume that the user name
user3
exists on system1
# The private key file
id_rsa
is accessible.
SSH="ssh
i id_rsa
l user3 system1 "
#
# Execute the command passed in as command line argument $1
${SSH} $1
56
Running the HP 3PAR Command Line Interface