From 03f4416b61da07ddb738b924497c7df55d39134e Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 28 Jan 2021 21:41:24 +0100 Subject: [PATCH] new: [myc-root-allow-0k-admin] add script to allow ssh access to 0k-admin on root account Signed-off-by: Valentin Lab --- README.org | 8 ++++++++ bin/myc-root-allow-0k-admin | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 bin/myc-root-allow-0k-admin diff --git a/README.org b/README.org index a23e46a..eb1d292 100644 --- a/README.org +++ b/README.org @@ -52,6 +52,14 @@ export DOMAIN=myhost.com wget https://justodooit.myceliandre.fr/r/deploy -qO - | bash #+END_SRC +Considérer la possibilité de mettre en place la clé =0k-admin= pour +accès au compte =root=: + +#+begin_src sh +myc-root-allow-0k-admin +#+end_src + + **** Hôte macosx - install bash, docker diff --git a/bin/myc-root-allow-0k-admin b/bin/myc-root-allow-0k-admin new file mode 100755 index 0000000..4739086 --- /dev/null +++ b/bin/myc-root-allow-0k-admin @@ -0,0 +1,18 @@ +#!/bin/bash + +if ! [ "$UID" == 0 ]; then + echo "Error: you must be root to run this command." >&2 + exit 1 +fi + +key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDri3GHzDt0Il0jv6zLjwkge48dN9tv11sqVNnKoDeUxzk4kn7Ng5ldd3p6dYL6Pa5NDqJUAhO/d/q08IWuwfEbtj8Yc/EkahcRwVD2imPceUeDgyCaOJhq7WO4c9d9yG8PnRO2+Zk92a9L5vuELVLr4UHIQOs2/eFRY2/ODV8ebf5L1issGzfLd/IPhX5oJwMwKfqIFOP7KPQ26duHNRq4bYOD9ePW4shfxmyQDk6dSImFat05ErT+X7703PcPx/PX2AIqqz95zqM6M26BywAohuaD5joxKgkd/mMIJylvT8GEYDlcLMHwnM7LtwtyJ1O9dkVpsibIqGy20KlAOGPf admin@0k" + +dest="/root/.ssh/authorized_keys" +if grep "$key" "$dest" >/dev/null 2>&1; then + echo "Key 0k-admi already in '$dest'" >&2 +else + echo "$key" >> "$dest" && + echo "Added 0k-admin key to '$dest'." >&2 +fi + +