Launching a process in remote machine

Hi all,
Normally to launch a process in the remote machine I will use ssh to the machine and launch the process.I want to launch the remote machine process with out login into the machine . Is there any way.
It may be any workaround method.

Thanks in advance .:slight_smile:

How is the remote box to know when you want to run your job? Telepathy does
not work well in the UNIX world :slight_smile:

With no communication at all:
use cron, set the process to run at a fixed time interval

A> Otherwise there has to be some kind of interaction. If you want system information, try setting up snmp, then request the information when you want it.

B> One system I had long ago: there was a daemon run by a special user account. It read email sent to that account. The subject line was a command to run. The daemon ran the command and emailed the output back. There are huge security issues with this nowadays.

modern way to to B>
nfs mount a filesystem shared on the two boxes. Create/edit files with special names in a restricted directory to do what B> above did.

Bottom line: ssh is much better, even if you have to script it. The choices above (except cron & snmp) can have problems with security

You might also use ftp/sftp to place a trigger file on the remote machine, and have spooler type process run if the file is present, then delete the file.

I run this on HP-UX to SSH to an AIX server.

/homeroot/.rsshpw - contains an encrypted password.
/home/unxsa/sbin/decrypt - is a perl program to decrypt the password.

You will have to put root's ssh passphrase into a file.

#!/usr/bin/expect -f
#
# Name: ssh_to_node_noninteractively.HP-UX
#
# Purpose: to run a command on a remote machine
#
# Date: June 2010
#
# Version: 1.2
#
# Required Parameters:
# -------------------------------------------------------------------------
#
# Optional Parameters:
# -------------------------------------------------------------------------
#
# Example execution statments:
# -------------------------------------------------------------------------
#
# Variables:
# -------------------------------------------------------------------------
#
# Change History:
# -------------------------------------------------------------------------
# Date          Name            Comments
# _________________________________________________________________________
# June 2010     purdym          new


###################################################################################
# Variables
###################################################################################
set timeout 3
match_max 100000

##################################################################################
# print_options
##################################################################################
if {$argc!=2} {
   send_user "usage: $argv0 hostname command\n"
   exit
}

# script must be run by root user
set whoami [exec id -u]
if {$whoami!=0} {
   send_user "You must be a root user to run this script\n"
   exit
}
###################################################################################
# command line args
###################################################################################
set host [lindex $argv 0]
set command [lindex $argv 1]

###################################################################################
# Start
###################################################################################
# use exec, not spawn here
set password [exec /home/unxsa/sbin/decrypt [exec /usr/bin/cat /homeroot/.rsshpw]]

# opem shell
spawn /usr/bin/ksh

# send passwd command
send -- "ssh -q '$host' '$command'\r"
expect {
   "'/homeroot/.ssh/identity':*" { send "$password\r" }

}

#
expect {
   eof
   timeout close

}

close

###################################################################################
# exit
###################################################################################
exit

Example:

:/homeroot>uname -a
HP-UX <hidden> B.11.31 U ia64 0489838128 unlimited-user license

:/homeroot>ssh_to_node_noninteractively.HP-UX <hidden> /usr/bin/uname
spawn /usr/bin/ksh
ssh -q '<hidden>' '/usr/bin/uname'
root@wpgux001:/homeroot>ssh -q '<hidden>' '/usr/bin/uname'
Enter passphrase for key '/homeroot/.ssh/identity':
AIX
:/homeroot>