• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need Unix/ssh help

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having this sttange problem now -

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

I have a third party C application "ABC" that we have compiled and running on server X. It runs fine and our server code (Java) interacts with application and gets some results.

This C application ABC is giving "segmenation fault" on the new 64 bit machine, and being a third party application we are not going to fix it.

A solution that has been suggested is this -

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!!!

This is sort of urgent, so would grealy appreciate help from Unix gurus!!!

Thanks,
- Manish
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to automate all this in a script, the authentication problem wil be taken care of. How do I do this in the script now -

ssh X ABC <parameters for ABC>
return results returned by ABC running on X

TIA,
- Manish
 
M Beck
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you do it exactly the way you just wrote it - "ssh X ABC". if this doesn't work for you, how does it fail?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first command line argument in ssh after the remote machine name is a command to be executed on the remote machine. The results from the execution of that command can be piped into any program on the local machine.

As an example, I'll SSH into a machine named remote (names changed to protect the innocent) and run the ls command on it. I'll then pipe the results of the ls command on the remote machine into the sort (with the -r option so I can see that it did something) command on my local machine:

I'm not using password files so I'll have to authenticate at the command line:




Once you get your password files all set up, you can do this from a script.
[ February 08, 2005: Message edited by: Ben Souther ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic