From 1621cddf38c32db6736003229fa0c701a203199e Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Fri, 21 Apr 2023 16:46:37 +0800 Subject: [PATCH] debug --- scripts/jumpserver_cron.sh | 5 +++++ scripts/jumpserver_deploy.sh | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/jumpserver_cron.sh b/scripts/jumpserver_cron.sh index 3d50534..38cc4b3 100755 --- a/scripts/jumpserver_cron.sh +++ b/scripts/jumpserver_cron.sh @@ -10,6 +10,11 @@ for file in $(find "$THIS_DIR/../authorized_keys" -type f); do (echo "# key file: ${file#*authorized_keys/}";cat "$file"; echo) >> "$tmp_path" done +if [[ ! -d "/home/ssh/.ssh" ]]; then + mkdir -p "/home/ssh/.ssh" + chown ssh:ssh "/home/ssh/.ssh" + chmod 700 "/home/ssh/.ssh" +fi cat "$tmp_path" > "$dest_path" rm "$tmp_path" chown ssh:ssh "$dest_path" diff --git a/scripts/jumpserver_deploy.sh b/scripts/jumpserver_deploy.sh index 420a06f..746406d 100755 --- a/scripts/jumpserver_deploy.sh +++ b/scripts/jumpserver_deploy.sh @@ -5,6 +5,7 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) adduser \ --disabled-password \ --home /home/ssh \ + --gecos "jumpserver user ssh" \ ssh insert_if_not_exist() @@ -17,4 +18,4 @@ insert_if_not_exist() grep -qxF -- "$line" "$filename" || echo "$line" >> "$filename" } -insert_if_not_exist "/etc/crontab" "*/5 0 0 0 0 cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/jumpserver_cron.sh" +insert_if_not_exist "/etc/crontab" "*/5 * * * * cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/jumpserver_cron.sh"