You can do this without having to do the sudo bit, it can be a bit tricky and the man page is a pain to read...
Instead, create some ssh-keys for your user on xyz1. copy the public key to the target user's .ssh directory in in home dir, into the file authorized_keys.
Now ssh as the user on xyz1 using the shiny new private key to xyz and run the script:
ssh -i /path/to/shiny/new/priv_key theotheruser@xyz "/path/to/your/script.sh"
Hope this helps a bit.
Another thing- it will make it easier if you could be a little less cryptic in your question- instead of hosts
xyz and
xyz1, users
user and
id you could just give them some names:
I have a script evilscript.sh accessable by eviluser on machine avalon. I have another user called bob on avalon as well. The user bob exists on machine houston.
I want my user bob on houston to log onto avalon then, using sudo, run script evilscript.sh as user eviluser.
makes it a bit easier for people to help you.
/fimblo