FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

fhscripts:create:create_ssh_keypair.sh.html



This is an old revision of the document!



FastHandle Scripts

create_ssh_keypair.sh

How to use

$ create_ssh_keypair.sh  user01  test-server-01


Script

#!/bin/bash
#===============================================
# create_ssh_keypair.sh
#
# How to use
#     create_ssh_keypair.sh   user01  test-server-01
#===============================================

if [ "$#" -ne 2 ] ; then
    echo 'ERROR:  argument isn't correct.'
    echo 'How to use:'
    echo 'create_ssh_keypair.sh  user01 test-server-01'
    exit 1
fi

USER=$1
HOST=$2

ssh-keygen -t rsa -b 4096 -C "${USER}@${HOST}"  -N "" -f id_rsa."${USER}"."${HOST}"


Example Output

$ create_ssl_csr_key.sh 192.168.0.15
Generating a 2048 bit RSA private key
....................................+++
.....+++
writing new private key to '192.168.0.15.key'
-----
==========================================================
Check
==========================================================

# ls -lh  192.168.0.15*
-rw-r--r-- 1 root root 1013 Dec 19 01:02 192.168.0.15.csr
-rw-r--r-- 1 root root 1.7K Dec 19 01:02 192.168.0.15.key

#openssl req -text -in 192.168.0.15.csr |grep "Subject:"
        Subject: C=JP, ST=Tokyo, L=Shibuya-ku, O=Example, Inc., OU=IT, CN=192.168.0.15



fhscripts/create/create_ssh_keypair.sh.html.1514132292.txt.gz ยท Last modified: 2017/12/25 01:18 by kurihara