Running commands remotely through SSH

This recipe shows you how to execute one-shot commands on a remote system through Secure Shell (SSH). Having the ability to run commands without establishing a full interactive session can be convenient because you can avoid running a second terminal; everything can be done directly from the same command line.

Getting ready

This recipe requires a remote system running the OpenSSH server and a local computer with the OpenSSH SSH client installed (both should be installed by default on CentOS). The examples assume that the remote system is configured with the IP address 192.168.56.100. Also, you will need a user account available on the remote system.

How to do it...

The following examples show you how to run commands ...

Get CentOS 7 Server Deployment Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.