View file on distant machine

Hello everybody,

I have a program that connects to a distant machine using a specific port. Then inetd executes a command on that distant machine (M2).

What I'd like to do is write a scipt that, given the port, it gives me the command executed. (The script should be launched on the local machine M1 and should look into the /etc/inetd.conf on the machine M2).

I have a username and password on the machine M2, so when I connect using rlogin, I can view the /etc/inetd.conf without any problem.

I tryed to do an FTP on my script (machine M1), but it's not possible (permission denied).

I tryed `rsh -l login cat /etc/inetd.conf`, no way.. (I can add my user to the .rhosts, but I want a script that could be launched from anywhere).

I tryed :
rlogin M2 -l user << STOP > file.tmp
password
cat /etc/inetd.conf
STOP

But the script showes the message "Closed connection." and the "file.tmp" is empty.

Any idea ?
Thanks in advance :slight_smile:

You cannot use rlogin to do this. The first lines in the man page of rlogin have this to say:
" rlogin establishes a remote login session from your terminal to the remote machine named hostname."

You could use rsh to do this, as you have already tried. I see no reason why that should fail.

Because with rsh, if the remote host doesn't have your login in its .rhosts file you won't be able to do anything. It doesn't prompt you for a password or anything..

If the server has ssh setup, you can use ssh...

and what's the difference ?

Command line ssh allows you to run a command remotely and ask you for a password if you do not have direct (password less) access. And that (direct access) is also pretty easy to setup.

Check the man pages for details on ssh.