update at 2026-03-21 18:44:12
This commit is contained in:
@@ -21,11 +21,17 @@ echo "Source keys: ${SOURCE_KEYS}"
|
||||
|
||||
for target_dir in "${ROOT_HOME}/.ssh" /root/.ssh /var/local/root/.ssh /mnt/us/usbnet/etc/dot.ssh; do
|
||||
echo "--- target: ${target_dir} ---"
|
||||
mkdir -p "${target_dir}"
|
||||
if ! mkdir -p "${target_dir}" 2>/dev/null; then
|
||||
echo "skip: cannot create ${target_dir}"
|
||||
continue
|
||||
fi
|
||||
if [ -f "${target_dir}/authorized_keys" ]; then
|
||||
cp "${target_dir}/authorized_keys" "${target_dir}/authorized_keys.bak.${TS}" || true
|
||||
fi
|
||||
cp "${SOURCE_KEYS}" "${target_dir}/authorized_keys"
|
||||
if ! cp "${SOURCE_KEYS}" "${target_dir}/authorized_keys"; then
|
||||
echo "skip: cannot write ${target_dir}/authorized_keys"
|
||||
continue
|
||||
fi
|
||||
chmod 700 "${target_dir}" 2>/dev/null || true
|
||||
chmod 600 "${target_dir}/authorized_keys" 2>/dev/null || true
|
||||
ls -ld "${target_dir}" "${target_dir}/authorized_keys" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user