![]() |
Easy Information For you | |
|
|
Running a Program on a Remote Server Using SSH
How do you run a program on a remote server using ssh? For this example we'll have two servers, one named Johnny and another named Cash. Both are running openssh. Our goal is to have a program on Johnny login to Cash and run a program on Cash. To make the task a little more complex we'll be using different users on each machine. The first thing we'll need to do is generate public and private keys on Johnny. So, logged into Johnny as user 'boy' we create public and private keys by creating them in the .ssh directory as follows:
In the example above we picked an arbitrary name, sue, to identify the files that hold the generated keys. When prompted to enter a passphrase (twice) we simply hit enter twice. As the output of ssh-keygen indicates, the public key has been saved in a file named sue.pub. The output of ssh-keygen implies, but doesn't indicate directly, that the private key is in a file named sue (Yes, a user named boy created a file named sue.)
The private key file, sue, will remain on Johnny for the reaminder of this exercise, but the public key must be moved to the remote server, Cash. Note that the .ssh directory itself, as well as the sue and sue.pub files should have permissions of 700. Now you'll need to ftp the sue.pub file from Johnny to Cash. The user on Cash that we'll login as is user 'named'.
Now we'll telnet into Cash and concatenate the sue.pub file into /home/named/.ssh/authorized_keys file.
Let's recap what we've done so far. 1) We've created public and private keys on Johnny. 2) We've ftp'd the public key file, sue.pub, from Johnny to Cash. 3) We've telnetted to Cash, and concatenated the contents of sue.pub into authorized_keys We're now ready to manually login from Johnny to Cash using ssh.
Now on Johnny, create a shell script called 'boynamedsue.sh' with the following one line of contents and chmod the script to 777. ssh -i /home/boy/.ssh/sue named@Cash /usr/bin/ls -l Next, execute the script on Johnny.
You just executed a program on Johnny, that logged into Cash and ran a program (unix 'ls -l'). The next step you'll want to take is to replace the '/usr/bin/ls -l' command in the boynamedsue.sh program with the path and name of the program that you want to run. About The Author C.S. Deam is a small business owner. His eBook Computer Nuggets: Non-Techie Internet Tips For In-Laws, Out-Laws, and the Rest of Society is a great gift for non-techie family members and is available at www.LinkertonPublishing.com where you can sign up for FREE E-Courses & Newsletters to help you on your path to self-employment.
MORE RESOURCES: » |
RELATED ARTICLES
Understanding XML Server XML Server can be a Web Server that stores the XML files in it and serves them on demand. The XML Server would have processing capabilities with an XML engine and to transform the XML document to other forms. Who's Watching What You Type? If someone entered your home, uninvited and installed numerous cameras and listening devices in order to monitor your activities, you would quite rightly be outraged. While such a situation, unless you are living in the Big Brother House, would be considered ridiculous, the same cannot be said for the humble home computer. Great Plains Dexterity Customization Options - Overview For Developers Looks like Microsoft Great Plains becomes more and more popular, partly because of Microsoft muscles behind it. Now it is targeted to the whole spectrum of horizontal and vertical market clientele. Who Is Minding Your Sensitive Data? Stealing company information used to be the specialty of spies and conspirators. It was something that only happened to the most powerful of corporations and branches of government. Five Steps to Rapid Development with TierDeveloper 4.0 Follow the steps below to quickly design, generate, and deploy a great portion of your real-life N-Tier application.STEP 1: HAVE YOUR DATABASE READY1. Mapping Software: Putting Data Visualization on the Map Mapping Software Improves Data VisualizationFrom the outset, it is important to clarify exactly what mapping software is and what it has to do with data visualization. If you are looking for driving directions for your next road trip, this is not the article for you. Microsoft Great Plains RW: Report Writer Microsoft Business Solutions Great Plains is marketed for mid-size companies as well as Navision (which has very good positions in Europe and emerging markets where it can be easily localized). Great Plains Report Writer (RW) module allows for modification and creation of Great Plains reports to suit your business needs. Secure File Transfer Using SSH Plus Additional Audit & Automation - FSA Reporting In order to meet regulatory and corporate compliance requirements reporting members will require a cost effective solution that may be installed at one side of the data transfer without being tied to any proprietary protocol.Considerations include:- is it designed for use in most enterprise environments?- is it flexible & adaptable to suit an unlimited range of needs for secure file transfer internally and externally? Functionality and benefits should include:+ can easily be adapted+ Automatic transfer to single or multiple destinations of any file. How To Develop Software For Your Business Software development is a risky business.Many software developers are barely skilled at their trade, much less at business. XML Parser and Their Types XML parser is a software module to read documents and a means to provide access to their content. XML parser generates a structured tree to return the results to the browser. Microsoft CRM Customization Secrets - Second Edition This article is for advanced Microsoft CRM SDK C# developers. It describes the technique of direct SQL programming, when SDK doesn't have the functionality to do the job. Microsoft CRM Implementation - Fundamental CRM Principles Revision Microsoft CRM is relatively new player on the now becoming traditional CRM software applications market. We would like just to mention shift in the technical conception - Microsoft CRM is committed to Windows and Microsoft components: Exchange, Active Directory, SQL Server, etc (while traditional CRM applications, such as Siebel were biased toward multiplatform compatibility: Unix, Oracle, Windows, SQL Server) and move up to business logic paradigm shift. Software Piracy SOFTWARE PIRACY We regularly hear reports about the cost to the software industry of software piracy, but are the claims to be taken at face value? Statistics are notoriously biased towards what the author is trying to say. Types of Software: There are three basic types of software, although these do have their own subsections, as will be discussed later: 1. What is Groupware? Vince Lombardi once said that, "The achievements of an organization are the results of the combined effort of each individual." If this is the case, then what do we need to do in order to insure success in our companies? How can we combine the efforts of each individual as Mr. Microsoft Great Plains customization - Freight Forwarding/Transportation industry example Microsoft Business Solutions Great Plains version 8.5, 8. Microsoft Small Business Manager Customization Options - Overview Microsoft Business Solutions Small Business Manager is Great Plains Dexterity based application and successor and small business market niche version of Microsoft Great Plains. Microsoft Great Plains itself has variety of customization and integration tools: Integration Manager, VBA/Modifier, Great Plains Dexterity, SQL Server stored procedures to name a few. Need of Document Management System (DMS) Document Management or Enterprise Information Management is perhaps one of the most important of the enterprise solutions that will provide a solution to the various requirements of SOX. Several sections of SOX have a direct bearing on the manner in which the digital documents/records of the enterprise are created, reviewed, approved, stored, retrieved, transferred, and destroyed. Microsoft Great Plains Installation - Overview for IT Director/Controller Microsoft Great Plains is main mid-market application from Microsoft Business Solutions. This is short article, written in question/answer/FAQ style to give IT Director/Controller balanced top level information on Microsoft Business Solutions Great Plains implementation. Great Plains Dexterity History and Programming Overview As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into Microsoft Great Plains and Microsoft Business Solutions is in process of merging all its accounting applications: Great Plains, Solomon, Navision and Axapta into somewhat granular: Microsoft Financials, Microsoft HR, Microsoft Distributions, Microsoft Project Accounting, etc. So the original design of Great Plains should be deemphasized. What is a Document Manager without Version History? Document Manager and Version HistoryIn previous articles I have discussed the usefulness of a document manager, such as groupware, in organizing document sharing. I have also discussed the role that a Version History plays in a good document manager. |
|
home | site map | Free Forum Host | Forums |
| © 2007 - 2008 |