wxz-zgc-pc (#86)
Reviewed-on: #86 Reviewed-by: ryanyu <ryy23@mails.tsinghua.edu.cn> Co-authored-by: U-DESKTOP-Q82J13B\wxz <wang-xz22@mails.tsinghua.edu.cn> Co-committed-by: U-DESKTOP-Q82J13B\wxz <wang-xz22@mails.tsinghua.edu.cn>
This commit was merged in pull request #86.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#!/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
|
||||
(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"
|
||||
chmod 600 "$dest_path"
|
||||
#!/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
|
||||
(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"
|
||||
chmod 600 "$dest_path"
|
||||
|
||||
Reference in New Issue
Block a user