I tried using tilde for my ssh key path. But that fails to find the key. I ensured that the path was correct. But, when I replaced the tilde with user homedir path, it worked fine.
Is the tilde expansion disabled or does it expand to root path? I did execute the script as own user. And there's the ssh key in that user's path.