[dev] first working version #4
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user