[dev] first working version #4

Merged
DictXiong merged 21 commits from dev into main 2023-05-30 13:21:29 +08:00
2 changed files with 7 additions and 1 deletions
Showing only changes of commit 1621cddf38 - Show all commits

View File

@ -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" (echo "# key file: ${file#*authorized_keys/}";cat "$file"; echo) >> "$tmp_path"
done 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" cat "$tmp_path" > "$dest_path"
rm "$tmp_path" rm "$tmp_path"
chown ssh:ssh "$dest_path" chown ssh:ssh "$dest_path"

View File

@ -5,6 +5,7 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
adduser \ adduser \
--disabled-password \ --disabled-password \
--home /home/ssh \ --home /home/ssh \
--gecos "jumpserver user ssh" \
ssh ssh
insert_if_not_exist() insert_if_not_exist()
@ -17,4 +18,4 @@ insert_if_not_exist()
grep -qxF -- "$line" "$filename" || echo "$line" >> "$filename" 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"