aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/ssh-keys-import.md33
-rw-r--r--ssh-keys-import9
2 files changed, 37 insertions, 5 deletions
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 <mail@eworm.de>
#
# 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 ];
+}