Difference between revisions of "Batch deployment of DSA key (SSH) and schedule backup with export"

From MikroTik Wiki
Jump to: navigation, search
Line 7: Line 7:
 
This creates a DSA key pair that is compatible with Mikrotik.
 
This creates a DSA key pair that is compatible with Mikrotik.
  
Make a file on your *nix host with the following content.
+
Make a file on your *nix host with the following content. Call the fil
  
 
<pre>#!/bin/sh
 
<pre>#!/bin/sh
Line 13: Line 13:
 
scp key_for_backup admin@$1:.
 
scp key_for_backup admin@$1:.
 
ssh admin@$1 "user ssh-keys import file=key_for_backup user=admin"
 
ssh admin@$1 "user ssh-keys import file=key_for_backup user=admin"
echo "$1 " >> node_liste
+
echo "$1 " >> node_list
 
</pre>
 
</pre>
  
 
$1 in this script is the first argument passed from command line with the script. It should be a hostname or a ip adresse.
 
$1 in this script is the first argument passed from command line with the script. It should be a hostname or a ip adresse.
  
yeah and more text.
+
<pre>sh distr_key.sh 192.168.10.1</pre> (make this file executible with "chmod 755 distr_key.sh" to avoid execute the shell with paramentre)
even more text
 
  
<pre>here comes script two</pre>
+
You will be prompted for the admin password twice, once for the file transfer and one for the import dsa-key command. When the script ends it will apply the hostname or ip adresse to a new file called "node_list".
 
 
more text
 

Revision as of 21:24, 21 May 2008

Pasting in script and information very soon.

Use this

%ssh-keygen -t dsa

This creates a DSA key pair that is compatible with Mikrotik.

Make a file on your *nix host with the following content. Call the fil

#!/bin/sh

scp key_for_backup admin@$1:.
ssh admin@$1 "user ssh-keys import file=key_for_backup user=admin"
echo "$1 " >> node_list

$1 in this script is the first argument passed from command line with the script. It should be a hostname or a ip adresse.

sh distr_key.sh 192.168.10.1
(make this file executible with "chmod 755 distr_key.sh" to avoid execute the shell with paramentre)

You will be prompted for the admin password twice, once for the file transfer and one for the import dsa-key command. When the script ends it will apply the hostname or ip adresse to a new file called "node_list".