How to establish a connection to a Linux machine using SSH

How to establish a connection to a Linux machine using SSH


A remote Linux machine’s command line interface (CLI) can be controlled by using a protocol such as SSH. This can be done from a system with a different OS or another Linux machine.


A Linux machine and a client machine (can be Linux or Windows). If the client machine is Windows, a tool for establishing an SSH connection may be obtained, such as PuTTY.


Linux client machine: You can establish an SSH connection with interactive control, or with batch mode, where output will be returned a single time only. To connect to a Linux machine in batch mode, type:

ssh -o “BatchMode yes” address_such_as_192.141.14.1 ‘command1 && command2’

Replace the address section with a valid destination address (the Linux machine you are connecting to). In the quotes, you can add whatever commands you choose. If you are using this ssh command in a script or program, such as with Perl, including the commands section in single quotes is useful so the rest of the script will not interfere with its contents. Output from the command will be returned (optionally placed into a variable).

To connect in interactive mode, simply type:

ssh address

The address portion may again be changed to the destination Linux machine’s address. You may be prompted to accept the consequences of connecting to an unknown (non-authenticated) address. You can type yes if you are sure this is the system you want to connect to. You may be asked to login. Then, you have control of the remote system, interactively. To exit, you may type:


Control will resume on the client.

Windows client machine:

To connect to a remote linux machine, you can install a tool, such as putty from When you have putty on your client, you can type the address of the remote Linux machine at the top and connect. Once connected, you may be asked for the same authentication verification prompts. Again, you can type yes, then login.

More Information:

On a Linux client, type:

man ssh

for more information.