Batch deployment of DSA key (SSH) and schedule backup with export

From MikroTik Wiki
Revision as of 21:50, 21 May 2008 by Ojsa (talk | contribs)
Jump to: navigation, search


Use SSH to execute commands (DSA key login) shows you how to create a DSA key file.

%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


scp admin@$1:.
ssh admin@$1 "user ssh-keys import 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.

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

You will be prompted for the admin password twice, once for the file transfer and once 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". This file will be used later on for the backup/export script.