1
0
forked from NASP/registry
This commit is contained in:
Dict Xiong 2023-04-21 16:46:37 +08:00
parent b29880ff81
commit 1621cddf38
2 changed files with 7 additions and 1 deletions

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"
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"

View File

@ -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"