SSH script

Hello All,
I have public keys authentication set up already on my system, to connect to another team's system. What I'm trying to do is to write a script that connects to the customer's box, changes to a certain directory, and then changes the permissions of the files in that directory.

ssh user@custserver
cd /custdirectory
chmod 644 file_name_*
exit

It's not working. Does anyone know how this should be done?

Thanks
Khoom

Yes.
ssh - it's interactive logon to system.
so, your script connected to server and waiting *your* actions.
if you want using script you should using some-thing like

#!/bin/sh
ssh user@custserver cd /custdirectory ; chmod 644 file_name_*

Er.. the ; would cause the chmod command to be executed locally and not on the custserver system. Escape the ; with \ to prevent the shell from interpreting the ;.

Mercy, it still isn't working....

sorry

ssh user@custserver chmod 644 /custdirectory/file_name_*