Control Panel => Terminal & SNMP => Terminal => Check "Enable SSH service"
Keep port 22, we will disable SSH at the end for security reason so no need to have some exotic config here
ssh <user>@<synology-ip>
The password is the one you use to log into your NAS (I do hope you have a password!)
sudo -i