Operating System - HP-UX
1833875 Members
1837 Online
110063 Solutions
New Discussion

Re: regarding remote commands

 
SOLVED
Go to solution
vind123
Regular Advisor

regarding remote commands

I want to run a ls -ltr or mv command in an remote unix machine from my unix machine and get the output of it. How do i do it? Is there any config files setting needs to be made
7 REPLIES 7
Peter Godron
Honored Contributor
Solution

Re: regarding remote commands

Hi,
depends on your setup.

The simplest is to add your details to a .rhosts file et al in the accounts home directory on the remote machine and then use remsh (See man remsh)

or get ssh
Tvs
Regular Advisor

Re: regarding remote commands

Hi

you can configure the .rhosts and try remsh command

remsh servername "ls -lrt"

or you can try to implement ssh also

Regards

tvs
sajeer_2
Regular Advisor

Re: regarding remote commands

Hi vind,

Create .rhosts file in user home directory.
check rlogin is working without password.
Once you are able to login using rlogin without password,you can run remsh command

#remsh remotehost ls

vind123
Regular Advisor

Re: regarding remote commands

Thanks a lot for the info
I want to do the below two unix commands in remote machine
ls -ltr
mv test.out /tmp/test.out

I gave the below way but it's not working
remsh inky -l fcc ls -tr ;mv test.out /tmp/test.out

The second move command is not getting executed in the remote machine. How do i run mulitple unix commands with remsh.
Peter Godron
Honored Contributor

Re: regarding remote commands

Hi,
multiple commands:

remsh inky -l fcc -n "ls -tr ;mv test.out /tmp/test.out"

see man remsh
Bill Hassell
Honored Contributor

Re: regarding remote commands

It is very important to note that your local shell will process many special characters until you escape them (remove their special meaning). The semicolon ; essentailly terminates the current remsh commandline and starts another process on your local machine. So you must enclose the entire command line for the remote machine in single quotes. For instance, these two commands have very different results:

remsh inky grep err /var/adm/syslog/syslog.log > /tmp/errors

remsh inky 'grep err /var/adm/syslog/syslog.log > /tmp/errors'

In the first example, the > is a special character and takes whatever remsh displays and puts into /tmp/errors on your local computer. The second example stores the errors file on the remote computer.


Bill Hassell, sysadmin
vind123
Regular Advisor

Re: regarding remote commands

Thanks a lot for the info