Browse Source

new: [myc-root-allow-0k-admin] add script to allow ssh access to 0k-admin on root account

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
rc1
Valentin Lab 4 years ago
parent
commit
03f4416b61
  1. 8
      README.org
  2. 18
      bin/myc-root-allow-0k-admin

8
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

18
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
Loading…
Cancel
Save