COMPUTERTUTORIALS

How to Set Up SSH on Linux: A Full Guide for Beginners

If you are a Linux user then you should know that one of the most important ways of using Linux is via SSH. You can do everything from installing software to configuring Linux as a web server with the help of remote access command line tool. SSH can save time, make you more productive, and help you unlock the power of your Linux distro.

But do you know how to Set Up SSH on Linux on both the client and server sides? If you don’t then here in this article of MAZHD, we will show you how to install and configure SSH software at both ends and remotely control your Linux computer.

Related: How to Test or Change Refresh Rate on Monitor Windows 10?

What Is SSH?

Simply SSH stands for Secure Shell and allows you to remotely control a Linux computer or server from another device. SSH (Secure Shell) works across local area networks and the internet. By saying that we meaning that it can be used to manage a Linux-powered media server in your house, or a Linux web server on a different continent.

SSH lets you use the terminal but doesn’t give you access to the remote computer’s desktop environment. When it’s connected to the remote computer you can use it as if it was right in front of you. Just be sure to have root access.

Remember that to use SSH, you’ll need to ensure that the remote computer (server) has SSH set up. Additionally, your local device (the client) will need an SSH app installing.

Client-Side Installation

It is easy and simple to install and set up SSH on a client. And may be there is no need to use any additional software.

Follow the steps below:

  • Linux users should find a SSH client built into the terminal
  • macOS computers also have SSH preinstalled in the terminal
  • Windows PCs will need to use the PowerShell command line tool, or install PuTTY
  • To connect to Linux over SSH from iPhone and iPad try iTerminal ($4.99)
  • If you’re using Android for SSH, try JuiceSSH (Free)

SSH not installed on your Linux system? Add by updating packages and upgrading, then installing:

sudo apt update && sudo apt upgrade

sudo apt install openssh-client

If you have recently switched to a Linux desktop but you used SSH on Windows then you might miss the PuTTY desktop SSH app with its easy mouse interface. But don’t worry, it can be installed on a Linux desktop:

sudo apt install putty

When you are done installing SSH client software, you’re ready to set up a connection to your remote computer or server.

Remember that for all desktop and mobile clients, all you need is an IP address or host name, and appropriate login details. While the look of the apps may differ, and the port name may need entering manually, SSH clients are mostly indistinguishable.

Server-Side Installation and Configuration

 Install the server-side software to host your SSH connection before establishing a connection. This requires someone to be present to install or enable SSH. You might already be present to do this—otherwise, a colleague or support engineer at the server end will set up SSH.

Remember that if you’re using a web hosting package, SSH should be enabled by default. Speak to your web host to set up SSH if not.

If SSH is not enabled on the remote computer or server, install it with

sudo apt install openssh-server

Check this worked with

sudo systemctl status ssh

The command should illicit a response of “active.”

In some cases the Ubuntu firewall ufw may block SSH. To ensure this doesn’t happen, use

sudo ufw allow ssh

In some cases you’ll need to also enable SSH on the remote device. This is a security precaution that can be tweaked using

sudo systemctl enable ssh

Other options are available (stopstart, and disable) for configuring the SSH service.

Determine IP Address

You have to find IP address of the machine in order to connect to the remote device over SSH. mostly it’s done via two easy ways.

  • Run a terminal command
  • Check the router

To display the IP address of the remote system, logon and run

ip address

This will return the device’s IP address, so take a note of it. On older Linux versions ifconfig may provide better results.

You can also check your router to see connected devices. The Linux PC or server will be listed, typically by operating system or device name. This should make it simple to identify.

To display the public IP address, login to the server and open whatsmyip.org.

It’s better to use the IP address which is suitable for the connection. Use the local IP address if the device is on the same network as the client. And use the public IP address for connections across the internet. If the computer is located on a different network, make sure that port 22 is forwarded to the computer.

Related: How to Optimize Windows 10 for Performance & Gaming?

Connecting to Linux via SSH

In addition to correct IP address, you should also have a username and password to gain access to the remote machine.

For command line SSH tools, use

ssh username@REMOTE.IP.ADDRESS.HERE

Remember to replace username with the actual username and REMOTE.IP.ADDRESS.HERE with the remote device’s IP address. Then hit Enter, and you’ll be prompted for the password.

With a correct password, you’ll get a functioning terminal prompt—you’re now logged into the remote computer.

Using a desktop SSH client like PuTTY?

After doing the steps above, input the Host Name or IP address, select the SSH connection type, then Open. When prompted for your username and password, enter them in the command line window to complete the connection and gain remote access.

Can’t Connect? Troubleshoot Your SSH Set Up

If you are done the process above and you still can’t connect or you are having SSH connection issues, these are the possible causes:

  • SSH software isn’t installed on either computer
  • Your username or password is incorrect
  • The IP address is wrong
  • A firewall is blocking the connection, or port 22 is not being forwarded

Double-check each point and you should be able to connect. If not, the problem might be more complex.

Using Linux Remotely With SSH

Moreover, SSH is a useful tool for managing one or more Linux computers.

With the help of SSH you can work on any machine from just one system. You can input almost any Linux terminal command over SSH.

Key examples include:

  • Update: sudo apt update && sudo apt upgrade
  • Check status: uptime
  • Running processes: ps
  • Running processes by CPU: top

Setup SSH and Make Linux More Powerful

With the help of SSH, Linux becomes considerably more flexible and powerful. You can literally remotely access a computer using a smartphone thanks to SSH.

Moreover, if SSH is set up correctly, with client and server-side software enabled and configured, remote command line access is possible.

Related Searches:

  • ssh command example
  • ssh server linux
  • putty
  • ssh command windows
  • SSH on Linux
  • how to connect from one server to another server in linux
  • ssh commands
  • ssh port
  • putty
  • ssh command with password
  • “ssh -l” command
  • putty
  • ssh configuration in linux
  • ssh connection refused
  • putty
  • ssh connection refused
  • ssh example
  • setting up ssh cisco
  • ssh meaning
  • ssh-keygen linux
  • how to set up ssh mac
  • ssh tutorial
  • ssh tutorial pdf
  • set up ssh windows
  • SSH on Linux
  • linus configure ssh
  • ssh server
  • putty
  • ssh tutorial ubuntu
  • SSH on Linux
  • set up ssh linux
  • SSH on Linux
  • ssh linux

If you have any problem setting up SSH on Linux or you have any question regarding of this title just leave a comment down below.

Source: makeuseof

Adib

Adib Zahedi is the CEO and Founder of mazhd.com. He has nearly a decade of experience in IT, including two years spent working on a Youtube Chennal. He is also an author and writes articles for mazhd.com. Has articles include tutorials and covers everything from Windows PCs to smartphone's software.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button