Recover /private/etc/ssh after accidentally deleting I'm working with macOS Sierra and I have accidentally deleted /private/etc/ssh.

How can I recover this folder so I can use SSH?

The last solution is to reinstall the OS, but I want avoid this.
After deleting your ssh folder and no backup you can reinstall some content using the macOS installer and recreate the keys yourself:

The default content of /private/etc/ssh in El Capitan or Sierra are these files:

moduli                          ssh_host_ed25519_key
ssh_config                      ssh_host_ed25519_key.pub
(ssh_config~orig)               ssh_host_rsa_key
ssh_host_dsa_key                ssh_host_rsa_key.pub
ssh_host_dsa_key.pub            sshd_config
ssh_host_ecdsa_key              (sshd_config~previous)            
ssh_host_ecdsa_key.pub          


Three of the files are part of the macOS installer and can be extracted and installed from the Sierra OS X Install ESD with Pacifist: moduli, ssh_config and sshd_config.

All other files can be created by using ssh-keygen or copying files:

sudo cp /etc/ssh/ssh_config /etc/ssh/ssh_config~orig #just a backup
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config~orig #just a backup


Key creation:

sudo ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key
sudo ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key
sudo ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key
sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key


This may invalidate some services relying on the old keys!