The commands I needed to run to allow SSH to a headless Debian 12 Pi OS install were:
mkdir /mnt/pi
mount /dev/sdc1 /mnt/pi
touch /mnt/pi/ssh
echo pi:$6$fGzsGCnOaRjJxAl7$oyr66oRzD4e5jIKmJgE7XxnvtgqbO4nSc.waww7ZKp4fHHINgGbjyng.SfzaAiMSD.MZLhqhJAgdbFt0om.iJ1 > /mnt/pi/userconf
umount /mnt/pi
sync
So I installed Raspberry Pi OS on a USB stick to play around with my Pi 3 again, and assumed I would be able to ssh
into it. But I couldn't, because SSH isn't enabled by default (I can't remember if it was before?). Getting it enabled was simple enough once I realised they meant I need to create an ssh file on the boot partition not inside the boot directory. But in recent versions of Raspbian / Raspberry Pi OS there is no default user any more, so then I also had to create one of them.
The method to do it is pretty simple, once you know what to do. I plugged the USB stick back into my PC. My USB stick is /dev/sdc and with the default Pi OS image at the moment partition 1 is the FAT32 boot partition, and partition 2 is the ext4 root partition.
The commands above mount the boot partition, create the ssh file to enabled sshd, then create a userconf file for a user pi with password raspberry (like it used to be). The sync is to make sure the data is written to the USB so you know when it's safe to unplug.
If you want to use a password other than raspberry you can generate it using the command echo 'password' | openssl passwd -6 -stdin
and replace the string above after the : . You can obviously also change the name before the : from pi to whatever you want.
Next time you boot the Pi from that disk it should automatically enable the SSH service, create a user, and then it will remove those 2 files from boot since you don't need them any more.