tools: examples: network - uncomment RSA and add info

Uncommented the line that injetcs the RSA key to allow for SSH
connections to the VM without initial login.
Add more information that if the file is missing, an initial login to
change passwords is required.

BUG=N/A
TEST=mdbook build

Change-Id: Ie0f94da693e04319b7b098df8bfe044ceeeeb8a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4698613
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Elie Kheirallah 2023-07-18 21:03:59 +00:00 committed by crosvm LUCI
parent e168a15cee
commit 1a41931529

View file

@ -22,13 +22,19 @@ if ! [ -f rootfs ]; then
# $SRC=/path/to/crosvm
--copy-in "$SRC/guest/01-netcfg.yaml:/etc/netplan/"
# Install sshd and authorized key for the user.
# Install sshd.
--install openssh-server
# OPTIONAL: inject RSA public key as known key
# --ssh-inject "$USER:file:$HOME/.ssh/id_rsa.pub"
-o rootfs
)
# Inject authorized key for the user.
# If the SSH RSA public key file is missing, you will need to login to
# the VM the first time and change passwords before you can login via SSH.
ID_RSA_PUB="$HOME/.ssh/id_rsa.pub"
if [ -r "${ID_RSA_PUB}" ]; then
builder_args+=("--ssh-inject" "${USER}:file:${ID_RSA_PUB}")
fi
virt-builder ubuntu-20.04 "${builder_args[@]}"
# ANCHOR_END: build