rsh problem

Dear,

I am trying to execute a script in the X machine by remote logging from machine Y. Note that in the X machine in host file the ip and the hostname of the Y is defined and in the .rhosts the hostname and the username of the Y is defined. By using the following:

rsh X -l username -n "sh scriptname"

I got permission denied.

any one can help me in solving this problem.

Thanks...
TONTAL