Computing.Net > Forums > Unix > remote ssh through script

remote ssh through script

Reply to Message Icon

Original Message
Name: anuaru
Date: September 25, 2006 at 18:01:47 Pacific
Subject: remote ssh through script
OS: SunOS
CPU/Ram: 12334
Model/Manufacturer: Sun-Fire-15000
Comment:

I am looking for a script that will ssh to a remote server and execute few one or more script that is in local machine or I can copy the script to remote server. Main help is required in remote ssh through script


AnuAru


Report Offensive Message For Removal


Response Number 1
Name: rpantula
Date: September 28, 2006 at 06:41:19 Pacific
Subject: remote ssh through script
Reply: (edit)

you will need to set up authentication between the two systems. This can be done ether via Kerberos keys or SSH based keys.

SSH:
1. Generate Key

ssh-keygen -t dsa

This will create 2 files:

$HOME/.ssh/id_dsa

$HOME/.ssh/id_dsa.pub

2. Copy content of id_dsa.pub on

remote machine which needs to scp or

ssh w/o password to this machine.

This content should be copied/appended to

remote machines following file:

$HOME/.ssh/authorized_keys

KERBEROS:
using ktutil, generate keys for the host ( if you do lot of remote scripts, or service keys if it is a autosys or cron job, or if it is a user specific, create a kerberos principal)

then the keytab files generated through the ktutil should be applied on the machine from where you are running the job from.

start the job with :
kinit -kt <keytab file>
....
...
your script
...
..
kdestroy


hope this helps.

regards
raghu


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: remote ssh through script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge