Software Information |
|
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.
|
RELATED ARTICLES
Device Driver Basics Most people understand that the "hardware" part of their computer is the real physical parts, like the keyboard, mouse, modem, hard drive and so on. They understand that the "software" is computer bits stored on the hard drive, CD-ROM, or other storage media. But most people are a little hazy about exactly what a "driver" is. Preventive Maintenance Software Companies Several software companies design programs for preventive maintenance. Most of the preventive maintenance software companies produce programs for facilities and businesses. Because many programs are adaptable, they can be used for different types of facilities. Some of the best know preventive maintenance software companies are SMGlobal, Inc., Sigma Data Systems, Inc., and Smartware Group. Microsoft Great Plains: Offshore Customization & Development ? Overview for Consultant When you visit department stores and see that majority of the apparels are produced in other countries, not US ? you probably do not worry about this fact. About 10 years ago, when Clinton's high tech era was at the inception ? we saw the signs of high tech professionals inflow in the USA from overseas. Nowadays the trend is reversed ? instead of importing high tech people, we are at the beginning of outsourcing to them in their overseas countries the programming workload. In this small article we'll concentrate on the Microsoft Business Solutions Great Plains customization specifics: Great Plains Dexterity (IDE and programming language), SQL programming with XML in/out bound, VBA/Modifier/Continuum, Crystal Reports, Web publishing/eCommerce Is Your Small Business Ready For A CRM Software Solution? I have yet to see a business that, sometimes in spite of themselves, didn't benefit from implementing a Customer Relationship Management (CRM) or a simpler Contact Management software solution. Open Source Concepts: Dual Licensing Explained We were recently faced with a decision: either to let a program that took us one year to code die, simply because we do not have enough time to maintain it, or make it open source. Dreamweaver vs FrontPage There are two major WYSIWYG(What You See Is What You Get) editors available for beginners. These are: Microsoft FrontPage and Macromedia Dreamweaver. So the question is which one is better? Unofficial Windows 98 SE Service Pack 2.0 RC2 Microsoft has never released a service pack for Windows98 SE, but I made a Service Pack for Windows98 SE users. Internet Security Threats: Who Can Read Your Email? Before being able to choose a secure Internet communication system, you need to understand the threats to your security. Microsoft CRM: Data Conversion ? Import from Act! Best Software Act! is very popular CRM for small and mid-size organization. This system attracts business owner by its low price, plus system is very easy to use. However if your business is growing you should reach the moment to implement more advanced CRM solution. Natural question is ? how do we convert the data from Act! to new CRM solution and the mapping of your objects for conversion. You would probably like to avoid operator data entry with potential numerous errors and mistypes. Assuming that you are IT specialist, we'll give you technical side of Act to MS CRM data migration: SQL Administrator Skills Required to Support Microsoft Great Plains Microsoft Great Plains is becoming more and more popular and we see new purchases among midsize and large corporations, where, in our opinion, Microsoft SQL Server DB administrator position is a must. If you are database administrator and you are part of the decision making team, purchasing Microsoft Business Solutions Great Plains for your corporation, we would like to set your expectation on the level of SQL knowledge, skills and experience needed to support Microsoft Great Plains in-house 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. Putting Screensavers Under Control No matter how much you enjoy your favorite screensavers, sometimes they can be rather annoying. Don't like them interrupting your presentations? Hate them disturbing you watching movies? Look no further. This article will show you how to gain full control over your screensavers in no time. Manufacturing Solutions for Microsoft Great Plains ? Overview for Consultant Microsoft Business Solutions Great Plains has full-featured manufacturing set of modules. In this small article we would like to give you highlights on what kinds of light customization you could deploy, before jumping into Microsoft Great Plains Manufacturing realm. Great Plains Manufacturing is targeted to discrete manufacturing clientele, which is opposite to process manufacturing ? food processing, mining, including precious metals/gold/platina, oil and gas / chemicals / agriculture. Manufacturing from accounting stand point is moving inventory into work in progress and then into finished goods. And this is where we have fundamental difference between discrete and process manufacturing. Marketing Your WinRunner Team It won't matter how effective your WinRunner Team is if no-one outside your immediate organization knows about your accomplishments. For this reason, marketing your WinRunner Team is vital to your success. When times get tough, executives look for cost-cutting measures. The QA group is often the first on the chopping block. If these high level executives don't fully understand and appreciate the value of your service, they will see the cost of WinRunner licenses and maintenance as well as the highly skilled, but also more expensive WinRunner engineers as a nice place to start trimming the budget. They will not have the time or luxury to launch an investigation to see if these services are really necessary. Spyware, What is it? Spyware, what it is and what it does. Basically, spyware is a program put on your computer usually after you have downloaded some kind of program or went to a certain site. Once this program is on your computer, depending on what kind was put on, has the potential to monitor what you're doing without you knowing it. 10 Ways to Learn a Software Following tips help you to learn a software in lesser time and in an efficient manner: 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. Basically a server which hosts and serves the XML documents is called a XML Server. Oracle Development: JDeveloper 10G ? Java, J2EE, EJB, MVC, XML - Overview For Programmer In 2004 Oracle, Inc. made its new step toward J2EE application development simplification, releasing new RAD Oracle JDeveloper 10G. First of all JDeveloper 10G is targeted to rapid web application building, utilizing all the achievements of J2EE World: web service, EJB, MVC frameworks, XML, etc. Oracle JDeveloper 10G allows you to conduct all full development cycle for complex system ? from UML diagram-based concept to debugging, profiling and deployment. MySQL for Beginners ? How to Create a MySQL Database Whether you are an experienced web programmer or a complete novice attempting to provide data interactivity with your web site, MyQSL is an easy to use and free database solution that can allow you to store and configure data to be displayed on your web site. Will Adobe Manage to Replace Industry Work Horse Quark Express by Giving Adobe InDesign for Free? And kill the best layout software in the process of gaining market share? |
home | site map |
© 2005 |