Skip to content

Commit

Permalink
Added generating an ssh key
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjaap committed Mar 2, 2025
1 parent 160c9d7 commit c4841a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions autoinstall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ autoinstall:
USER_HOME="/home/$USERNAME";
echo "Detected user $USERNAME";'

# Generate SSH key
- curtin in-target --target=/target -- bash -c '
USERNAME=$(getent passwd 1000 | cut -d: -f1);
USER_HOME="/home/$USERNAME";
if [ -d "$USER_HOME" ]; then
sudo -u $USERNAME mkdir -p "$USER_HOME/.ssh";
sudo -u $USERNAME ssh-keygen -t rsa -b 4096 -C "[email protected]" -f "$USER_HOME/.ssh/id_rsa" -N "";
sudo -u $USERNAME chmod 700 "$USER_HOME/.ssh";
sudo -u $USERNAME chmod 600 "$USER_HOME/.ssh/id_rsa";
sudo -u $USERNAME chmod 644 "$USER_HOME/.ssh/id_rsa.pub";
echo "SSH key generated for $USERNAME";
fi'

- curtin in-target --target=/target -- bash -c '
echo "Installation paused. Create /tmp/continue to proceed.";
while [ ! -f /tmp/continue ]; do sleep 5; done'

0 comments on commit c4841a3

Please sign in to comment.