Originally posted by Manish Hatwalne:
We have 2 live servers
(1) X ==> A normal 32 bit machine running Linux
(2) Y ==> A new AMD 64 bit machine running almost same config as X
Server Y runs application ABC (it's a C executable, and not a service running on server at specific port as such) on server X via a shell script available on Y that in turn does SSH to run ABC on X and gets the results, and ths script gives those results to server code running on Y.
How do I do this??? Has someone done sth similar? Any idea how I can do this between X and Y? An example would be GREAT!!!
i do this sort of thing every day.
first you have to ensure that server X has the ssh daemon (sshd) installed and running by default. it will listen on port 22/TCP, so you'll have to ensure that port is reachable through any firewalls or network security you may have installed.
client Y needs to have the ssh client program installed and runnable by whoever wants to use application ABC. this person doesn't necessarily
have to have a username and password to log in to server X, but it helps for getting started.
the simplest, most straight-forward way to use ssh is simply to log in to your client machine, Y, and say "ssh X", using X's full hostname. you'll be prompted for your password - unless you specify otherwise, ssh will assume for simplicity that your username on X is the same as your username on Y and try to log in with that. (to use a different username, read ssh's man page and note the "-l" parameter.) once you're logged in on machine X, you can run any program you wish there - including graphical programs,
if you have X-Windows started on machine Y first. once you're done, just type "exit" at the shell prompt on X and your SSH session to X will end.
there is a way to bypass the password prompting, by using RSA authentication instead of password authentication. it's a bit more advanced subject, though; it involves creating a ".ssh" subdirectory in your home directory (on both machines!) and creating some specific files in those directories; it's a somewhat involved process, but it generally only needs doing once. the best way to learn this is probably to buy the O'Reilly book on SSH (
this book) and read the chapters on public-key authentication.
when you first get SSH RSA authentication running, you may be confused that SSH still asks you for a password - even though that's what you were trying to avoid. yes, it does ask for a password, this being the password to the RSA key in your ~/.ssh directory; to get around this, you need to have ssh-agent running as well. if you have ssh-agent running, you'll be asked for the password to your RSA key only once, when you first log in; after that, you'll be able to just SSH over with no questions asked. a lot of Linux distributions will automatically start ssh-agent when you log in,
if you have the right files set up in your ~/.ssh directory. if yours doesn't do this, try reading that book i linked to, and/or investigate getting
gentoo keychain to run on your machine. (it runs on mine, and does a great job.)
[ February 08, 2005: Message edited by: M Beck ]