Setting up and destroying passwordless ssh to sun storage

Setting passwordless ssh to sun storage

Setting up of storage passwordless ssh is different from server to server method. Sun storage uses restricted shell, which makes the storage safe and exposes what its needed for us to manage.
Below script can be written to Sun storage or just copy paste the commands.
We have to transfer id_rsa token of the current server to the storage which you need passwordless ssh.
Based on your system, use RSA or DSA keys. Here I'm using RSA keys

If you dont have a key, generate once with
ssh-keygen -q -f ~/.ssh/id_rsa -N ''

#!/bin/bash

export key=`cat ~/.ssh/id_rsa.pub |cut -d " " -f2`
export key=`echo "\""$key"\""`

ssh exasn01<<EOF
script
run('configuration preferences keys')
run('create')
run('set type=RSA')
try {
run('set key=$key')
run('set comment="Exa"')
run('commit')
}
catch(err){
if (err.code == EAK_BADARG){
        printf ('Key already exist\n ');
 }
                }

EOF


Destroy passwordless ssh from sun storage

If you want to delete key to remove passwordless ssh, login into the storage and follow the simple steps. In this we are going to delete the key "Exa" which is created in the above example.

ssh exasn01
exasn01:>configuration preferences keys
exasn01:>show -- will show the list of keys available and name will be displayed in left side column
exasn01:>destroy key-021 -- The key "Exa" have the name "key-021"