rsh login to host with password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rsh login to host with password
# 1  
Old 04-22-2010
rsh login to host with password

Hello,
iḿ rather new to writing scripts in UNIX so i thought this would be a good start.

I need to write a script that can login to different hosts in a standalone network. That means there are no connection to Internet etc. I need to collect some data on the hosts, and they have different usernames and passwords to access the information. This is what i have been trying:

rsh -l username host_xxx

that works fine, i get a password question and im in.

When i try to:

rsh -l username host_xxx /bla/blabla/mything

i doesnt work because it wants my password before executing mything i guess.

Is there a way to give it the password right away?
I read some about ssh, but that is hardly an option for me here, it is a pain getting approval to put something new on the hosts.
# 2  
Old 04-22-2010
Yes, using expect (you would have to install...)...
But there is another alternative: using .rhosts file (do a man of hosts.equiv or .rhosts...)
# 3  
Old 04-22-2010
Quote:
Originally Posted by vbe
Yes, using expect (you would have to install...)...
But there is another alternative: using .rhosts file (do a man of hosts.equiv or .rhosts...)
Ok,
so if i understand you correctly i need to edit the .hosts file on all hosts including the server im accessing them from?
Is there any way its possible without changing the hosts file. It is hard to get permission to do changes in files on the system im working on.

Or is it another way of accessing remote hosts that might do the trick?
# 4  
Old 04-23-2010
Read the man pages, the file doesnt exist by default and depending of flavours, will only work if correct permissions are set to file.
.rhosts is to be found in the user's home directory generally set rwx------
# 5  
Old 04-23-2010
I have acess to the .hosts file and can change it, but im not allowed to do that kind of changes on the system becasue of security reasons, (not on the actual system). This is going to be moved and used in a sequre environment and there is a big process to change permissons/files and so on.

Is there a way to write a script that changes users when you actually are on the correct host? For example

Now i do: su - xxx
password: xxx

can i put that in a script or is that impossible. Trying to get arround using .hosts and Expect

If so i can use rsh to log in and execute the script with the permissions i have. Then i can have the script change permissions and run the things i need and have it sent back to me?

Feels like a long shot i now, but im running out of ideas Smilie
# 6  
Old 04-23-2010
not .hosts but .rhosts file
Once set properly it will allow you to do a rlogin to a host with -l user without passwd...
Now if you what to connect to remote host using your own account ( with .rhosts you will not be asked passwd...) then trying to su - <user> without passwd, that calls for sudo installation and configuration ( adding in sudoers file...)
# 7  
Old 04-23-2010
A .rhosts file should be created in the home directory of the target user on the target computer. The .rhosts file should have permissions 600 and be owned by that user or root. There are security implications.
See "man 4 .rhosts".

The simplest form of a line in a .rhosts file is just:
computername username

"computername" must match the exact name of the source computer if looked up on the target computer through hosts or dns.
"username" is the name of the user from the source computer. That account does not have to exist on the target computer.

Once the .netrc is working both "rsh" (or more usually "remsh") and "rlogin" will not need a password. It is usually quicker to test with "rlogin".


Footnote:
An "rsh" (or more usually "remsh") without any commands becomes an "rlogin" command. This is why you got prompted for the password. See the man pages.
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