rsh login to host with password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rsh login to host with password
# 8  
Old 04-30-2010
Ok,
thank you all very much for the help.

I have another issue connected to this.

When i do rsh i give it two commands:
rsh <host> setenv $myPath; $mySecCommand >> <filename>

that works perfect when i set the .rhosts file on the target host. But when i dont set the .rhosts file it gives me an error message, but it seems like it can do the setenv anyway and i get what i want, without the correct permissions? Is this a "hole" in the sequrity. Because doing it this way i actually dont need the .rhosts file. I get what i want even if it complains.
# 9  
Old 04-30-2010
Please post real commands and a description of what you expect to happen and proof of what actually happened.

Quote:
rsh <host> setenv $myPath; $mySecCommand >> <filename>
The command posted runs two separate commands on the local computer, one of which is a "rsh". The semi-colon is actioned locally, as is the ">> <filename>".
# 10  
Old 04-30-2010
you mean, that after the semi-colon its actioned locally? Or is everything actioned locally, nomather what i rsh connect too?

And is that the case even if i do get a connection remotely or is it just when i dont get access?
# 11  
Old 04-30-2010
After the semi-colon is executed locally.
The "rsh" is itself a local command but the parameters (in this case up to the semi-colon) are executed on the remote machine as shell commands.

If we escape the semi-colon the second command gets executed on the remote computer too. The log file still gets created on the local computer.
Code:
rsh <host> setenv $myPath \; $mySecCommand >> <filename>

If we escape the ">>" the log file should get created on the remote computer.
Code:
rsh <host> setenv $myPath \; $mySecCommand \>\> <filename>

It is better to use the "-n" switch to "rsh" to be 100% sure what is going to happen to any i/o. For example.
Code:
rsh -n <host> setenv $myPath \; $mySecCommand >> <filename>


To me personally this is all academic. For anything beyond the simplest command line I would put the commands into a script on the remote machine and execute the script with:
Code:
rsh <host> -n "scriptname <parameter>"

The script itself would contain a shebang line and anything needed to set up a suitable environment to run the process.



A quick way to check which computer a command is executed on:
rsh remote_machine -n "uname -n";uname -n
rsh remote_machine -n "uname -n"\;"uname -n"

Last edited by methyl; 04-30-2010 at 01:08 PM.. Reason: Last rsh line was wrong.
# 12  
Old 05-03-2010
Lightbulb

Quote:
Originally Posted by methyl
After the semi-colon is executed locally.
The "rsh" is itself a local command but the parameters (in this case up to the semi-colon) are executed on the remote machine as shell commands.

If we escape the semi-colon the second command gets executed on the remote computer too. The log file still gets created on the local computer.
Code:
rsh <host> setenv $myPath \; $mySecCommand >> <filename>

If we escape the ">>" the log file should get created on the remote computer.
Code:
rsh <host> setenv $myPath \; $mySecCommand \>\> <filename>

It is better to use the "-n" switch to "rsh" to be 100% sure what is going to happen to any i/o. For example.
Code:
rsh -n <host> setenv $myPath \; $mySecCommand >> <filename>


To me personally this is all academic. For anything beyond the simplest command line I would put the commands into a script on the remote machine and execute the script with:
Code:
rsh <host> -n "scriptname <parameter>"

The script itself would contain a shebang line and anything needed to set up a suitable environment to run the process.



A quick way to check which computer a command is executed on:
rsh remote_machine -n "uname -n";uname -n
rsh remote_machine -n "uname -n"\;"uname -n"
Thanks, this was really helpfull and also an eye opener Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

RCP slow down and blocks login, telnet, rsh, etc on target server

Hello I have a LPAR AIX 6.1 on Power VM, Vio 2.2.3 and when I execute a rcp to this machine, I cant, simultaneosly, rlogin, telnet, rsh to this same LPARt. This commands stay hanged till the copy end, and Imeddiatlely the comand is executed (rlogin, telnet, rhs, etc). Someone can give me... (1 Reply)
Discussion started by: artur_dietrich
1 Replies

2. Shell Programming and Scripting

Login to remote host and execute commands

Hi, i want to write script where it will login into 50 hosts and if login is successful it print message "login to host1 is successful" if not it should print message "Not able to login to host1". once connection to the host is succesful it should fire df command to check filesystem if df is... (3 Replies)
Discussion started by: amru8810
3 Replies

3. Shell Programming and Scripting

Login to multiple host without using Expect

Hello , I have a problem which involves a set of command should be executed on remote host and output should be stored in a file. But due to security reason I can not use expect to enter the password and its not possible to create password less login for multiple user to do the same thing and we... (10 Replies)
Discussion started by: pratapsingh
10 Replies

4. Solaris

Can i bind to a local login terminal running using rsh or remotely

Hi Can i ask? I had multiple solaris workstation running and some local users using it. Is it possible to bind to the local user terminal or console he's using as if like the user well type and I can see it and what my typing in the local user see it also. Is it possible.. Thanks. (3 Replies)
Discussion started by: jao_madn
3 Replies

5. Shell Programming and Scripting

rsh to many hosts the ftp output to single host

Hi guys. i need some help, i need to create a script in tcsh that rsh into all my hosts that we have at our business, then cd to a directory (cd /apps/users) then grab a file from the users folder and ftp it back to my windows machine. can someone please help? Kind regards. Brian Behrens (2 Replies)
Discussion started by: brian112
2 Replies

6. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

7. UNIX for Dummies Questions & Answers

rsh as super user without password prompt

Dear forum, First off, I'm using Solaris 5.6 UNIX. I'm trying to write a script which will connect to remote computers on a network (by specific IP's from a hosts file) and will run a separate script which is installed in each of the remote computers. My problem is that to run the script in the... (1 Reply)
Discussion started by: TheMightyUrrrrf
1 Replies

8. UNIX for Dummies Questions & Answers

RSH password problem

Hello, I am currently trying to execute a command in a Windows machine from a UNIX server. In order to do this, I am using the RSH command in UNIX but whenever i do this I am getting this error "RSHD: <username>: could not retrieve password: Please login and run rsetup." I log in via the... (0 Replies)
Discussion started by: punyenye
0 Replies

9. UNIX for Dummies Questions & Answers

remote login through a script ( except rsh)

Hi Guys, I'm having a problem trying to change to a different user within a script . I want to change to a specific user and then run the subsequent commands using his previleges . I remember having used ' su ' some years back for this , can't figure it out now !! Help appreciated . (3 Replies)
Discussion started by: rahma
3 Replies
Login or Register to Ask a Question