Connecting to Remote Servers via SSH

A super-quick guide on how to leverage SSH keys for remote connections (on Unix)

Photo by Adam Solomon on Unsplash


  • Here is the resource I checked.

I’ll assume that you have a working SSH key ready to go — or check out this guide to set things up.

The command is stunningly simple. Open your terminal and type in the following command.

# username is your user handle in the system
# hostname can be something like:
ssh username@hostname

After hitting enter you might see a bunch of output printed to your screen, also the host will likely ask for your password as a second layer of authentication. There will not be a second window popping up or anything (at least not by default) — it will run directly in your terminal.

From here on out you can interact with the server as you would with your terminal:

  • cd into directories
  • ls things
  • mkdir's
  • or whatever the system will permit you to do

After taking care of business you can quit your session by typing exit in the terminal or press ctrl + d

# simply disconnect by executing

The one basic thing that you will likely want to do after having established a connection: Transferring files

  • Here & Here are the two resources that I read up on.


scp username@hostname:/remote/path/to/file /local/folder/path/

To download files you have to specify the connection again like you did when connecting to the host. Additionally, you provide the path to the file or folder you want to download. Notice the colon between the hostname and path.


scp /local/path/to/file username@hostname:/remote/path/to/folder

This works like downloading, only the path specification is reversed. We define the local path first, then the remote path.

Of course, there is much more you can do with your access. However, I found most people just want this one basic thing and nothing to do with more specific stuff like SSH tunneling or preserving terminal sessions, etc.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store