SSH connection for headless setup

I’m new to the raspberry pi world.
I want to connect to my raspberry pi 4 - which is fresh out of the box - via ssh. It has the uptodate Raspberry Pi OS 32-bit desktop installed. I have the ip address which response well to pings.
However the ssh connection is refused - error: ssh: connect to host port 22: Connection refused
I have set up a empty ssh file into the boot section on the SD card.
SSH connections to other computers work well.
Anybody can help.

Yes, I do this regularly. I’ve just checked my notes and SSH’d into a spare Pi to check; you need to have run /usr/bin/raspi-config by just typing raspi-config, change your user password, then in interfacing options select SSH.

You can also test an SSH connection from the Pi to itself, using ssh 0. If that works and your other computer still gets connection refused, it means you have wrong IP address somehow.

I don’t have access directly to the raspi-config as I can only access the Pi via network (headless Pi). Is there another via to access the raspi-config?
BTW the ip address is the same when I ping raspberrypi.local - so it should be correct.

No, not really. It is a security feature. You have to either connect a keyboard, mouse and display, or pull the microSD card out and change the settings by hand, or in another Pi.

Thanks for your help.
Just one last question. I can’t find a raspi-config file in the boot section. Are you able to advise which file I should search for on the SD card to manually change this.

Sorry, no. The raspi-config program is a shell script, and it does this;

sudo update-rc.d ssh enable
sudo invoke-rc.d ssh start

Those are standard Debian commands which enable and start the service. The commands vary over time, and which init system is used, so I can’t explain reliably what they do. It’s a task for which a second Pi is very useful. Or a virtual machine.

Thank you for your help.
I think the easiest is to get peripherals for my pi and set it up via the GUI.