I have a use case where I want a user to connect to a target host via SSH but I do not want to leave the private key behind (the private key is retrieved via an API)
Is this possible via openSSH or once the user ssh's to the target system can we no longer execute commands on the original host?
The option LocalCommand
can be used
ssh user@host -o LocalCommand="echo hello > test.tmp"
Or in your case
ssh user@host -o LocalCommand="rm ~/.ssh/onetime_id_rsa"