Running root script upon ssh'ing as a particular user, but not upon standard login

Solution 1:

The easiest way is to use a forced command against an SSH key.

Create an SSH key for the user with ssh-keygen and add the public key to ~/.ssh/authorized_keys for user ABC, prefixing it with command="/some/script"

The script can contain the sudo commands you want to run and then exec a shell if needed.