From 997ef3bf2379c1526e39544067c8257d5e999b14 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 27 Mar 2020 21:50:53 +0100 Subject: add doc/ssh-keys-import.md --- doc/ssh-keys-import.md | 33 +++++++++++++++++++++++++++++++++ ssh-keys-import | 9 ++++----- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 doc/ssh-keys-import.md diff --git a/doc/ssh-keys-import.md b/doc/ssh-keys-import.md new file mode 100644 index 0000000..d221072 --- /dev/null +++ b/doc/ssh-keys-import.md @@ -0,0 +1,33 @@ +Import SSH keys +=============== + +[◀ Go back to main README](../README.md) + +Description +----------- + +This script imports public SSH keys (files with extension "`pub`") into +local store for user authentication. + +Requirements and installation +----------------------------- + +Just install the script: + + $ScriptInstallUpdate ssh-keys-import; + +Usage and invocation +-------------------- + +Copy files with extension "`pub`" containing public SSH keys for your device. +Then run the script: + + / system script run ssh-keys-import; + +Starting with an `authorized_keys` file you can split it on a shell: + + while read type key name; do echo $type $key $name > $name.pub; done < authorized_keys + +--- +[◀ Go back to main README](../README.md) +[▲ Go back to top](#top) diff --git a/ssh-keys-import b/ssh-keys-import index da933ce..9be92d1 100644 --- a/ssh-keys-import +++ b/ssh-keys-import @@ -3,9 +3,8 @@ # Copyright (c) 2013-2020 Christian Hesse # # import ssh keys from file +# https://git.eworm.de/cgit/routeros-scripts/about/doc/ssh-keys-import.md -# Split files with several keys from a shell... -# while read type key name; do echo $type $key $name > $name.pub; done < keys.pub -# ... then transfer with scp/sftp. - -:foreach Key in=[ / file find where type="ssh key" ] do={ / user ssh-key import user=admin public-key-file=[ / file get $Key name ]; } +:foreach Key in=[ / file find where type="ssh key" ] do={ + / user ssh-key import user=admin public-key-file=[ / file get $Key name ]; +} -- cgit v1.2.3-54-g00ecf