From 310dac2125bce5391c68ebdad1fb48df28582ce8 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Thu, 30 Mar 2023 01:39:08 +0800 Subject: [PATCH] jumpserver_deploy.sh init --- scripts/jumpserver_deploy.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/jumpserver_deploy.sh b/scripts/jumpserver_deploy.sh index e69de29..8b019b8 100644 --- a/scripts/jumpserver_deploy.sh +++ b/scripts/jumpserver_deploy.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -ex +THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) + +tmp_path="/tmp/authorized_keys" +dest_path="/home/ssh/.ssh/authorized_keys" +echo "# This file is autoly generated. Changes here will not work." > "$tmp_path" + +for file in $(find "$THIS_DIR/../authorized_keys" -type f); do + (cat "$file"; echo) >> "$tmp_path" +done + +cat "$tmp_path" > "$dest_path" +rm "$tmp_path"