Solved

running scripts remotely

Posted on 2000-05-03
10
243 Views
Last Modified: 2010-04-21
Hello,

I am try to run a job from one unix box and have it run on another without manually typing in any information? That way I can submit a job in the scheduler and it will connect and excute the script on an other unix box.
0
Comment
Question by:rp15
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 1

Expert Comment

by:meerak
Comment Utility
Which OS are u using?

From  solaris:
rsh <machine name> -l <username> <script name>
From hp
remsh <machine name> -l <username> <script name>

You need to have the .rhosts file properly set for these commands to
work properly.

For eg. If you allow machine1 with user user1 to access your machine,
then have the following line in ~/.rhosts

machine1 user1.
0
 

Expert Comment

by:bsher
Comment Utility
using rsh and put into cron.
crontab -u username -e
0
 

Author Comment

by:rp15
Comment Utility
I believe using crontab means that you are setting up a certain time when these jobs are going to be run. I have never actually used so please let me know if that is a correct statement.  If it is then in my case that would not help me.  To give you an example of how me scheduler works.  I will kick off the schedule manually to begin with and then jobs will run once the jobs they are dependent on have finished. Also I need to be able to send a password since my passwords are different on each machine.
0
 

Author Comment

by:rp15
Comment Utility
The OS want to send the command from is AIX version 4.  The operating system for the the unix box I want to run the script on is SMP_DC_OSx.  One of my problems that I am encountering is that I can not send my password over to the second machine.  Which is important since my passwords are different.  Also, is there a way to send a password by using the .rhost file?
0
 
LVL 2

Expert Comment

by:GP1628
Comment Utility
rsh is not suggested for reasons of security. You might look at ssh (secure shell) instead.

Actually just about any method of doing this is going to be considered insecure. Is the script a changing one or will the jobs on the receiving system always be the same? Did you just need a way to signal those machines to run their scripts?

Gandalf  Parker
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Expert Comment

by:meerak
Comment Utility
You need not give passwords in you ~/.rhosts file.

For eg. If you have an username "usr1" in a machine1 and
"usr2" on machine2.

In the file /home/usr1/.rhosts (Assuming this is your home directory)
of the machine1 have the following entry.

machine2 usr2

Assuming from machine2 you execute script on machine1:

machine2> rsh machine1 -l usr1 <command name or script>

It should work without any problem.
0
 

Expert Comment

by:CASIOFL
Comment Utility
rp15, I'm not too familiar with AIX, but I believe AIX is system V unix flavor like Solaris 2.x.  Although not recommended for security reasons, and I'm assuming that the loginID's home directory is the same and is nfs mounted to all the machines in question.  Just create a .rhosts file in the LoginId's home directory with the following entry in it:
   + loginID

replace the loginID with the your loginID. This should give trusted access to execute any commnads to available to that loginID without any system asking you for a passwd. Note that executable commands only available to root will still not available to the loginID.

As to the script, as long as you do not execute in the background the script will wait for the previous command to finish before continuing with normal execution.

Hope this helps..
0
 

Expert Comment

by:troyrock
Comment Utility
I would suggest using a scripting language on your AIX machine.  A language like 'expect' would be able to do everything that you would do while sitting there - wait for the 'login:' or 'password:' prompt and "type" the appropriate thing in.  There is a huge security problem here because the script that you feed expect would have to have your password in it so you could try to protect it by setting the permision of the file to r------- but your system administrator (root) would still be able to read it and then get access to your remote machine (but then again maybe this isn't a concern or maybe you are root).
0
 
LVL 2

Expert Comment

by:GP1628
Comment Utility
still no answer to my questions so here is alittle of where I was headed.
A much more secure way is to have scripts running in the background of all the machines watching for a signal to run the script.

If the script is the same every time then they can even just watch for a certain login from a certain machine. If it is the same but needs a few bits of info then the script ca be watching for a small file to appear which has the variables, use the file for input on the script, then delete the file, continue watching.

There are other features of this which can be discussed but the gist of it is that a very low-permission restricted login can be used to signal a very high permission (even root) kickof of a script.

Gandalf  Parker
0
 
LVL 2

Accepted Solution

by:
ish earned 100 total points
Comment Utility
I wouldn't recomend this to anyone...  almost any "remote running" of scripts is a security flaw...

2 possible answers:

#1: using the rsh to get to server2 from server1 have the .cshrc run a command on login that starts your proccess.....

#2: NFS/crontab trick (I use this one, so I know it works).  Set your crons or at (or what ever scheduler you use) to run when needed (possibly kicked by the rsh?)  and have it look to an NFS mounted partition for the prescence of DATA.FILE on /export/DATA (or whatever you want to call it).

have /export/DATA be an NFS mounted partition from server1 -> server2.
   if file exists then input and run; rm file
   if file does not exsist then mail status and terminate.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now