Discussion Locked

Logtounixinthebackgroundfromashellscript

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I log on to unix machine in the background
by executing a shell script?That is,on executing a
shellscript,the username and pwd are entered at the prompt.How do I login at the background without getting the login and password prompt?

5 replies

by ptpage

You can use the rsh command. Check the man page, but in general you have to tell the remote machine to trust the source machine to have already authenticated the user.

You do this by putting the source hostname and the source user name, in the file $HOME/.rhosts on the remote machine for the user whose account you will log into.

Notice that the remote host will get the source host's IP address from the socket connection. It must be able to do a reverse lookup on this address to find the source host's name.

So for example, I have two machines, machone and machtwo, and I want to run a script on machone that will run a program on machtwo. I put the following in my .rhosts file on machtwo:
machone ptpage

There are other ways toconfigure this. hosts.equiv(4) will give more info.

Be aware that if the source machine is Windows, it will usually deliver the user id in uppercase. Also you will want to be sure that you actually trust Windows to do the authentication. Depending on the configuration, it's often possible to pretend you're someone else.

by kshcsuf

You can also use ssh and setup a client and server host key. You'll want to take a peek at the SSH 2 or SSH 3 documentation for this, as it is a fairly complicated process (and already described elsewhere.) ssh is a significantly better solution for security because the text traffic is encrypted. Also, if you are performing this background process across a WAN or leased line(s), you can enable compression of the ssh traffic for increased performance.

This discussion is closed to new replies.