On Fri, Jan 24, 2025 at 09:40:50AM +0100, PICCA Frederic-Emmanuel wrote: > Hello, I would like to customize the debian-installer in order to allow root > access once installed via an authorize key. > > so I need to put something like this in the /root/.ssh/ during the > installation > > echo "ssh-rsa > AAAAB3NzaC1yc2EAAAADAQABAAACAQDGkFpSsCIGpAJtsH4TWHCatHMkdGMS/PTG2M/7xeWz6Syw/JUrZPc/5bRC9H5+bikrhotZOidC+lafzGFHGmHzpq7+rXrd5Np3uHH6U+Y0O7mUeU0CVhCpkIr2ggk4Bw7K79/d6fsPXZi2h+JAZ9cBaI6ob5K6e70Ljj3REZRh7LXBVIAd1hmMPEESb5xll1MHvB/7Qn6r6uupcOY/pC/LH+ZPUaqvwXGrSltFjJoeFEW8H05uYkuZta5vBG/owdLjRt6v7h3tnINsMV4S0uKNQNz6022xAptn1FY1WQ0F1y738hTNoikITty//MB3HW3uQEpw4sXN7tEGqQtHrbMkPfcwb+KMISXYlHPaBt9ik4fWnt55U1IzXr5s/ErT6/ZCG2iPfnffuHnCVMujrUu+KcnHtF7Ux50N1QxR7+EiT6WxRDW3S6Vz0MQ6jTZdy/YryKYZtGnriFb2RwRu9Y7Df+VYfj4nKrnF3JQF9yipBLcUhpliNvByvoh7eTE8iWuVlp3GkdHotEq4okH88TtUG5DBbddGHoGpxnzi8R4sn+YvFTybywwhKgMQh0ueJ26j326AgujBDlvL3Hf6Satz/EDmwjStWGSwWQAcy+W+gfNAuRfHpyYHKDGPIJLzMfuf0vx0KLL0C55x7I4cGqOIT22RXLhhf9NFHNDi4Q== > cardno:000500001073" > /root/.ssh/authorized_keys > > Is it a feature provided by d-i ?
You can do this with preseed/late_command (https://www.debian.org/releases/bookworm/amd64/apbs05.en.html#preseed-hooks, and see https://www.debian.org/releases/bookworm/amd64/apb.en.html for general advice on preseeding if you haven't used it before). Something like this should work: d-i preseed/late_command string mkdir -p /target/root/.ssh; echo 'ssh-rsa ...' >/target/root/.ssh/authorized_keys -- Colin Watson (he/him) [cjwat...@debian.org]