Connect to differect server and execute the script

Hello Everyody

Please help me with the below problem.

I have two servers names server1 and server2.
From server1, i have to connect to server2 and execute a script residing on server2. How can i achieve this?

The commands you are looking for are rsh and/or ssh. Lots of online docs on how to use them...

server1> ssh user@server2 command

I have tried this and it is working. if i do it manually, command will prompt me for the password, and after entering, it will execute the script on the other server.
But i wish to automate. Like, i will create a script named script1 , i wish to place the ssh command to connect to other server and execution of other script. It should not prompt me for a password. Is this possible?

Yes, you would just then be configuring ssh to accept user@system1 without a password. You should easily be able to find configuration for this.

Search this site (on the top right) for "public key authentication"

You have build a trust relation between those 2 server. you can find N nunbers of document floating around on this topic.

Google it out..!!!!:slight_smile: