Shell script to log into another user

Hi i have not don anny scripting before so pls answer simple:)

I want to make a shell script that i can use to execute a program on a nother
pc. They are both using CentOS.

The command i use to execute to program from my computer is:

First i open a terminal and write:

#ssh -X gw302 (i am using aliases)

then i am promped for password
after inserting the password i must change user on the other computer:

#su gsss

then i am promped for a nother password
and final i can start the program:

#GPS_SUPERV

Is there a way to make a shell script to do all this?

man ssh-keygen

Can u explain a bit to?
Remember i am new to this

This a topic that is easy to google and also easy to find in the forums here using the search engine.
You might want to use some pattern like "ssh without password" for example. If you try it out and it still does not work, post here again with an explicit error description please.

Okey i will try that, have tryed to googled it but have not found any usable there yet.