FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


fhscripts:create:create_ssh_keypair.sh.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
fhscripts:create:create_ssh_keypair.sh.html [2017/12/31 23:32]
kurihara
fhscripts:create:create_ssh_keypair.sh.html [2018/02/25 00:39]
kurihara
Line 1: Line 1:
 [[:index.html#FastHandle Scripts|FastHandle Scripts]] [[:index.html#FastHandle Scripts|FastHandle Scripts]]
-====== create_ssh_keypair.sh ======+====== Script for Creating SSH Keypar with one-line ======
  
 $FHHOME/fhscripts/create_ssh_keypair.sh $FHHOME/fhscripts/create_ssh_keypair.sh
  
-\\ 
 {{INLINETOC}} {{INLINETOC}}
 \\ \\
  
-===== How to use =====+===== How to use create_ssh_keypair.sh=====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
 $ create_ssh_keypair.sh  user01  test-server-01 $ create_ssh_keypair.sh  user01  test-server-01
Line 22: Line 21:
 Your public key has been saved in id_rsa.user01.test-server-01.pub. Your public key has been saved in id_rsa.user01.test-server-01.pub.
 The key fingerprint is: The key fingerprint is:
-1b:97:af:30:66:11:e9:4e:30:e6:db:bc:f2:54:c3:a4 user01@test-server-01+a4:f9:99:44:ab:53:d7:09:13:cb:de:10:43:e8:54:f5 user01@test-server-01
 The key's randomart image is: The key's randomart image is:
-+--[ RSA 4096]----+++--[ RSA 2048]----+ 
 +|         +*..    | 
 +|        o. = .   | 
 +|       oo *   
 +|       =.o * .   | 
 +|      o S o +    | 
 +|       = +       | 
 +|      o +        | 
 +|               |
 |                 | |                 |
-|               | 
-|      + o .      | 
-|     o + = .     | 
-|      . E *      | 
-|       * * o     | 
-|      . @      | 
-|      .+ + .     | 
-|       oo .      | 
 +-----------------+ +-----------------+
 ========================================================== ==========================================================
Line 39: Line 38:
 ========================================================== ==========================================================
  
-# ls -ltrh  id_rsa* |tail -n 2 +# ls -ltrh  id_rsa.user01.test-server-01* |tail -n 2 
--rw-r--r-- 1 fasthandle fasthandle  747 Dec 25 01:36 id_rsa.user01.test-server-01.pub +-rw-r--r-- 1 root       root        403 Jan  01:06 id_rsa.user01.test-server-01.pub 
--rw------- 1 fasthandle fasthandle 3.2K Dec 25 01:36 id_rsa.user01.test-server-01+-rw------- 1 root       root       1.7K Jan  1 01:06 id_rsa.user01.test-server-01 
 </sxh> </sxh>
  
Line 60: Line 60:
  
 if [ "$#" -ne 2 ] ; then if [ "$#" -ne 2 ] ; then
-    echo 'ERROR:  argument isn't correct.\' +cat << @ 
-    echo 'How to use:' +ERROR : argument isn't correct. 
-    echo 'create_ssh_keypair.sh  user01 test-server-01' +How to use: 
-    exit 1+  create_ssh_keypair.sh  user01 test-server-01 
 +
 +exit 1
 fi fi
  
Line 69: Line 71:
 HOST=$2 HOST=$2
  
-ssh-keygen -t rsa -b 4096 -C "${USER}@${HOST}"  -N "" -f id_rsa."${USER}"."${HOST}"+OUTFILE=id_rsa."${USER}"."${HOST}" 
 + 
 +test -f ${OUTFILE} && mv ${OUTFILE} ${OUTFILE}.`date +%Y%m%d_%H%M` 
 +test -f ${OUTFILE}.pub && mv ${OUTFILE}.pub ${OUTFILE}.pub.`date +%Y%m%d_%H%M` 
 + 
 +ssh-keygen -t rsa -b 2048 -C "${USER}@${HOST}"  -N "" -f ${OUTFILE}
  
  
Line 76: Line 83:
 Check Check
 ========================================================== ==========================================================
-  + 
-# ls -ltrh  id_rsa* |tail -n 2 +# ls -ltrh  ${OUTFILE}* |tail -n 2 
-`ls -ltrh id_rsa* |tail -n 2` +`ls -ltrh ${OUTFILE}* |tail -n 2` 
- +
 @ @
 </sxh> </sxh>
  
  
 +\\ 
 +\\ 
 +<WRAP box 90%> 
 +<catlist ..: -noAddPageButton -smallHead -sortAscending  -sortAscending> 
 +</WRAP>


fhscripts/create/create_ssh_keypair.sh.html.txt · Last modified: 2018/03/29 00:06 by kurihara