Running commands on a remote host with SSH
SSH is an interesting system administration tool that gives you access to a shell on a remote computer which you can use to run commands. SSH stands for Secure Shell as it transfers the network data transfer over an encrypted tunnel. This recipe will introduce different ways in which commands can be executed at a remote host.
Getting ready
SSH doesn't come preinstalled with all GNU/Linux distributions, and you may have to install the openssh-server
and openssh-client
packages using a package manager. SSH service runs at default port number 22.
How to do it...
- To connect to a remote host with the SSH server running, use:
$ ssh username@remote_host
In this command:
username
is the user that exists at the remote ...
Get Linux Shell Scripting Cookbook - Second Edition 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.