1
0
forked from NASP/registry
registry/scripts/jumpserver_deploy.sh

17 lines
499 B
Bash
Raw Normal View History

2023-03-30 01:39:08 +08:00
#!/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
2023-03-30 14:04:03 +08:00
(echo "# key file: ${file#*authorized_keys/}";cat "$file"; echo) >> "$tmp_path"
2023-03-30 01:39:08 +08:00
done
cat "$tmp_path" > "$dest_path"
rm "$tmp_path"
2023-03-30 14:04:03 +08:00
chown ssh:ssh "$dest_path"
chmod 600 "$dest_path"