General discussion

Locked

Logtounixinthebackgroundfromashellscript

By sankar_2209 ·
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?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Logtounixinthebackgroundfromashellscript

by PTPage In reply to Logtounixinthebackgroundf ...

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.

Collapse -

Logtounixinthebackgroundfromashellscript

by sankar_2209 In reply to Logtounixinthebackgroundf ...

Poster rated this answer

Collapse -

Logtounixinthebackgroundfromashellscript

by kshcsuf In reply to Logtounixinthebackgroundf ...

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.

Collapse -

Logtounixinthebackgroundfromashellscript

by sankar_2209 In reply to Logtounixinthebackgroundf ...

Poster rated this answer

Collapse -

Logtounixinthebackgroundfromashellscript

by sankar_2209 In reply to Logtounixinthebackgroundf ...

This question was closed by the author

Back to Linux Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums