Back to Blog

How to Use SSH - Basics

Poster for How to Use SSH - Basics

Secure Shell (SSH) is an important tool to manage servers and work with remote systems. It is used to access and manage remote systems over the network in a safe manner. This article describes how to make use of SSH commands.


1. Understanding SSH

SSH is a protocol used in configuring remote login securely from one computer to another. It allows strong authentication of users and provides encrypted data communication between two computers connecting over an open network.


2. Generating SSH Keys

To connect to a server with SSH, you'll first need to generate an SSH key pair on your local machine — an RSA and DSA are available. This key pair includes a private key (kept secret) and a public key (shared with servers).


ssh-keygen -t rsa -b 4096


This command generates a new SSH key, using the provided email as a label.


3. Copying the SSH Key to Your Server

Once the SSH key is generated, you need to copy that public key to the server which you want to access.


ssh-copy-id user@hostname


Replace user with your username and hostname with the IP address or domain name of the server. For example:


ssh-copy-id [email protected]


4. Connecting to the Server

To connect to your server via SSH, use the following command:


ssh user@hostname


For example:


ssh [email protected]


5. Transferring Files Using SSH

SSH can also be used to securely transfer files between systems using the scp command.

To copy a file from your local machine to a remote server:


scp /path/to/local/file user@hostname:/path/to/remote/directory


To copy a file from a remote server to your local machine:


scp user@hostname:/path/to/remote/file /path/to/local/directory


6. Using SSH for Secure Browsing

SSH can create a secure tunnel for browsing the internet. This can be useful when you need to securely access internal network resources.


ssh -D 8080 -C -N user@hostname


This command sets up a SOCKS proxy on port 8080.


Conclusion

SSH is a strong instrument which provides both secure communication and remote systems management. By mastering this very basic part of SSH, you can dramatically boost the security as well as the efficiency of your remote operations.

Was this page helpful?

By continuing to use this site you consent to the use of cookies in line with our Cookies Policy.